You are here

public function DrupalAttributes::hasClass in Express 8

Indicates whether an attributes object has a specific class.

This is a wrapper method to retrieve the correct attributes storage object and then check there if a class exists in the attributes object.

Parameters

string $class: The class to search for.

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

Return value

bool TRUE or FALSE

See also

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

3 calls to DrupalAttributes::hasClass()
Element::colorize in themes/contrib/bootstrap/src/Utility/Element.php
Adds a specific Bootstrap class to color a button based on its text value.
Element::isButton in themes/contrib/bootstrap/src/Utility/Element.php
Indicates whether the element is a button.
Element::setButtonSize in themes/contrib/bootstrap/src/Utility/Element.php
Adds Bootstrap button size class to the element.

File

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