You are here

public function DrupalAttributes::getAttributes in Express 8

Retrieves a specific attributes object.

Parameters

string $type: (optional) The type of attributes to use for this method.

Return value

\Drupal\bootstrap\Utility\Attributes An attributes object for $type.

File

themes/contrib/bootstrap/src/Utility/DrupalAttributes.php, line 178
Contains \Drupal\bootstrap\Utility\DrupalAttributes.

Class

DrupalAttributes
Class for managing multiple types of attributes commonly found in Drupal.

Namespace

Drupal\bootstrap\Utility

Code

public function getAttributes($type = DrupalAttributes::ATTRIBUTES) {
  if (!isset($this->attributes[$type])) {
    $attributes =& $this
      ->offsetGet($this->attributePrefix . $type, []);
    if ($attributes instanceof Attribute) {
      $attributes = $attributes
        ->toArray();
    }
    $this->attributes[$type] = new Attributes($attributes);
  }
  return $this->attributes[$type];
}