You are here

public function DrupalAttributes::replaceClass in Express 8

Replaces a class in an attributes object.

This is a wrapper method to retrieve the correct attributes storage object and then replace the class(es) in it.

Parameters

string $old: The old class to remove.

string $new: The new class. It will not be added if the $old class does not exist.

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

Return value

$this

See also

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

File

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