A class that defines a type of Attribute that can be added to as an array.
To use with Attribute, the array must be specified. Correct:
$attributes = new Attribute(); $attributes['class'] = array(); $attributes['class'][] = 'cat';
Incorrect:
$attributes = new Attribute(); $attributes['class'][] = 'cat';
Hierarchy
- class \Drupal\Core\Template\AttributeValueBase
- class \Drupal\Core\Template\AttributeArray implements \ArrayAccess, \IteratorAggregate
See also
\Drupal\Core\Template\Attribute
File
- core/lib/Drupal/Core/Template/AttributeArray.php, line 25
Namespace
Drupal\Core\Template
Members
Name | Modifiers | Type | Description |
---|---|---|---|
AttributeArray::exchangeArray | public | function | Exchange the array for another one. |
AttributeArray::getIterator | public | function | |
AttributeArray::offsetExists | public | function | |
AttributeArray::offsetGet | public | function | |
AttributeArray::offsetSet | public | function | |
AttributeArray::offsetUnset | public | function | |
AttributeArray::RENDER_EMPTY_ATTRIBUTE | constant | Ensures empty array as a result of array_filter will not print '$name=""'. Overrides AttributeValueBase::RENDER_EMPTY_ATTRIBUTE | |
AttributeArray::__toString | public | function | Implements the magic __toString() method. Overrides AttributeValueBase::__toString |
AttributeValueBase::$name | protected | property | The name of the value. |
AttributeValueBase::$value | protected | property | The value itself. |
AttributeValueBase::render | public | function | Returns a string representation of the attribute. |
AttributeValueBase::value | public | function | Returns the raw value. |
AttributeValueBase::__construct | public | function | Constructs a \Drupal\Core\Template\AttributeValueBase object. |
Please login to continue.