AttributeValueBase

Defines the base class for an attribute type. Hierarchy class \Drupal\Core\Template\AttributeValueBase See also \Drupal\Core\Template\Attribute File core/lib/Drupal/Core/Template/AttributeValueBase.php, line 11 Namespace Drupal\Core\Template Members Name Modifiers Type Description AttributeValueBase::$name protected property The name of the value. AttributeValueBase::$value protected property The value itself. AttributeValueBase::render public function R

AttributeBoolean::__toString

public AttributeBoolean::__toString() Implements the magic __toString() method. Overrides AttributeValueBase::__toString File core/lib/Drupal/Core/Template/AttributeBoolean.php, line 39 Class AttributeBoolean A class that defines a type of boolean HTML attribute. Namespace Drupal\Core\Template Code public function __toString() { return $this->value === FALSE ? '' : Html::escape($this->name); }

AttributeBoolean::render

public AttributeBoolean::render() Returns a string representation of the attribute. While __toString only returns the value in a string form, render() contains the name of the attribute as well. Return value string The string representation of the attribute. Overrides AttributeValueBase::render File core/lib/Drupal/Core/Template/AttributeBoolean.php, line 32 Class AttributeBoolean A class that defines a type of boolean HTML attribute. Namespace Drupal\Core\Template Code public functio

AttributeBoolean

A class that defines a type of boolean HTML attribute. Boolean HTML attributes are not attributes with values of TRUE/FALSE. They are attributes that if they exist in the tag, they are TRUE. Examples include selected, disabled, checked, readonly. To set a boolean attribute on the Attribute class, set it to TRUE. $attributes = new Attribute(); $attributes['disabled'] = TRUE; echo '<select' . $attributes . '/>'; // produces <select disabled>; $attributes['disabled'] = FALSE; ech

AttributeArray::__toString

public AttributeArray::__toString() Implements the magic __toString() method. Overrides AttributeValueBase::__toString File core/lib/Drupal/Core/Template/AttributeArray.php, line 71 Class AttributeArray A class that defines a type of Attribute that can be added to as an array. Namespace Drupal\Core\Template Code public function __toString() { // Filter out any empty values before printing. $this->value = array_unique(array_filter($this->value)); return Html::escape(implode(

AttributeArray::RENDER_EMPTY_ATTRIBUTE

Ensures empty array as a result of array_filter will not print '$name=""'. Overrides AttributeValueBase::RENDER_EMPTY_ATTRIBUTE See also \Drupal\Core\Template\AttributeArray::__toString() \Drupal\Core\Template\AttributeValueBase::render() File core/lib/Drupal/Core/Template/AttributeArray.php, line 33 Class AttributeArray A class that defines a type of Attribute that can be added to as an array. Namespace Drupal\Core\Template Code const RENDER_EMPTY_ATTRIBUTE = FALSE;

AttributeArray::offsetUnset

public AttributeArray::offsetUnset($offset) File core/lib/Drupal/Core/Template/AttributeArray.php, line 57 Class AttributeArray A class that defines a type of Attribute that can be added to as an array. Namespace Drupal\Core\Template Code public function offsetUnset($offset) { unset($this->value[$offset]); }

AttributeArray::offsetSet

public AttributeArray::offsetSet($offset, $value) File core/lib/Drupal/Core/Template/AttributeArray.php, line 45 Class AttributeArray A class that defines a type of Attribute that can be added to as an array. Namespace Drupal\Core\Template Code public function offsetSet($offset, $value) { if (isset($offset)) { $this->value[$offset] = $value; } else { $this->value[] = $value; } }

AttributeArray::offsetGet

public AttributeArray::offsetGet($offset) File core/lib/Drupal/Core/Template/AttributeArray.php, line 38 Class AttributeArray A class that defines a type of Attribute that can be added to as an array. Namespace Drupal\Core\Template Code public function offsetGet($offset) { return $this->value[$offset]; }

AttributeArray::offsetExists

public AttributeArray::offsetExists($offset) File core/lib/Drupal/Core/Template/AttributeArray.php, line 64 Class AttributeArray A class that defines a type of Attribute that can be added to as an array. Namespace Drupal\Core\Template Code public function offsetExists($offset) { return isset($this->value[$offset]); }