function public function DrupalAttributes::getAttributes

8.x-3.x DrupalAttributes.php public DrupalAttributes::getAttributes($type = DrupalAttributes::ATTRIBUTES)

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.

Class

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

Namespace

Drupal\bootstrap\Utility

Source src/Utility/DrupalAttributes.php (line 174)

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];
}