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;
}
doc_Drupal
2016-10-29 08:45:04
Comments
Leave a Comment

Please login to continue.