public function DrupalAttributes::addClass in Express 8
Add class(es) to an attributes object.
This is a wrapper method to retrieve the correct attributes storage object and then add the class(es) to it.
Parameters
string|array $class: An individual class or an array of classes to add.
string $type: (optional) The type of attributes to use for this method.
Return value
$this
See also
\Drupal\bootstrap\Utility\Attributes::addClass()
File
- themes/
contrib/ bootstrap/ src/ Utility/ DrupalAttributes.php, line 142 - Contains \Drupal\bootstrap\Utility\DrupalAttributes.
Class
- DrupalAttributes
- Class for managing multiple types of attributes commonly found in Drupal.
Namespace
Drupal\bootstrap\UtilityCode
public function addClass($class, $type = DrupalAttributes::ATTRIBUTES) {
$this
->getAttributes($type)
->addClass($class);
return $this;
}