public function Attributes::replaceClass in Express 8
Replaces a class in the attributes array.
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.
See also
\Drupal\bootstrap\Utility\Attributes::getClasses()
File
- themes/
contrib/ bootstrap/ src/ Utility/ Attributes.php, line 136 - Contains \Drupal\bootstrap\Utility\Attributes.
Class
- Attributes
- Class to help modify attributes.
Namespace
Drupal\bootstrap\UtilityCode
public function replaceClass($old, $new) {
$classes =& $this
->getClasses();
$key = array_search($old, $classes);
if ($key !== FALSE) {
$classes[$key] = $new;
}
}