AttributeArray::getIterator

public AttributeArray::getIterator() File core/lib/Drupal/Core/Template/AttributeArray.php, line 80 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 getIterator() { return new \ArrayIterator($this->value); }

AttributeArray::exchangeArray

public AttributeArray::exchangeArray($input) Exchange the array for another one. Parameters array $input: The array input to replace the internal value. Return value array The old array value. See also ArrayObject::exchangeArray File core/lib/Drupal/Core/Template/AttributeArray.php, line 95 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 exchangeArray($input) { $old = $this->valu

AttributeArray

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\AttributeValueBaseclass \Drupal\Core\Template\AttributeArray implements \ArrayAccess, \IteratorAggregate See also \Drupal\Core\Template\Attribut

Attribute::__toString

public Attribute::__toString() Implements the magic __toString() method. Overrides MarkupInterface::__toString File core/lib/Drupal/Core/Template/Attribute.php, line 285 Class Attribute Collects, sanitizes, and renders HTML attributes. Namespace Drupal\Core\Template Code public function __toString() { $return = ''; /** @var \Drupal\Core\Template\AttributeValueBase $value */ foreach ($this->storage as $name => $value) { $rendered = $value->render(); if ($rendered)

Attribute::__construct

public Attribute::__construct($attributes = array()) Constructs a \Drupal\Core\Template\Attribute object. Parameters array $attributes: An associative array of key-value pairs to be converted to attributes. File core/lib/Drupal/Core/Template/Attribute.php, line 80 Class Attribute Collects, sanitizes, and renders HTML attributes. Namespace Drupal\Core\Template Code public function __construct($attributes = array()) { foreach ($attributes as $name => $value) { $this->offsetS

Attribute::__clone

public Attribute::__clone() Implements the magic __clone() method. File core/lib/Drupal/Core/Template/Attribute.php, line 315 Class Attribute Collects, sanitizes, and renders HTML attributes. Namespace Drupal\Core\Template Code public function __clone() { foreach ($this->storage as $name => $value) { $this->storage[$name] = clone $value; } }

Attribute::toArray

public Attribute::toArray() Returns all storage elements as an array. Return value array An associative array of attributes. File core/lib/Drupal/Core/Template/Attribute.php, line 303 Class Attribute Collects, sanitizes, and renders HTML attributes. Namespace Drupal\Core\Template Code public function toArray() { $return = []; foreach ($this->storage as $name => $value) { $return[$name] = $value->value(); } return $return; }

Attribute::storage

public Attribute::storage() Returns the whole array. File core/lib/Drupal/Core/Template/Attribute.php, line 331 Class Attribute Collects, sanitizes, and renders HTML attributes. Namespace Drupal\Core\Template Code public function storage() { return $this->storage; }

Attribute::setAttribute

public Attribute::setAttribute($attribute, $value) Sets values for an attribute key. Parameters string $attribute: Name of the attribute. string|array $value: Value(s) to set for the given attribute key. Return value $this File core/lib/Drupal/Core/Template/Attribute.php, line 205 Class Attribute Collects, sanitizes, and renders HTML attributes. Namespace Drupal\Core\Template Code public function setAttribute($attribute, $value) { $this->offsetSet($attribute, $value); return

Attribute::removeClass

public Attribute::removeClass() Removes argument values from array of existing CSS classes. Parameters string|array ...: CSS classes to remove from the class attribute array. Return value $this File core/lib/Drupal/Core/Template/Attribute.php, line 244 Class Attribute Collects, sanitizes, and renders HTML attributes. Namespace Drupal\Core\Template Code public function removeClass() { // With no class attribute, there is no need to remove. if (isset($this->storage['class']) &am