You are here

public function DrupalAttributes::setAttribute in Express 8

Sets an attribute on an attributes object.

This is a wrapper method to retrieve the correct attributes storage object and then set an attribute on it.

Parameters

string $name: The name of the attribute to set.

mixed $value: The value of the attribute to set.

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

Return value

$this

See also

\Drupal\bootstrap\Utility\Attributes::setAttribute()

File

themes/contrib/bootstrap/src/Utility/DrupalAttributes.php, line 326
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 setAttribute($name, $value, $type = DrupalAttributes::ATTRIBUTES) {
  $this
    ->getAttributes($type)
    ->setAttribute($name, $value);
  return $this;
}