function public function DrupalAttributes::addClass

8.x-3.x DrupalAttributes.php public DrupalAttributes::addClass($class, $type = DrupalAttributes::ATTRIBUTES)

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

Class

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

Namespace

Drupal\bootstrap\Utility

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

public function addClass($class, $type = DrupalAttributes::ATTRIBUTES) {
  $this->getAttributes($type)->addClass($class);
  return $this;
}