You are here

public function DrupalAttributes::hasAttribute in Express 8

Indicates whether an attributes object has a specific attribute set.

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

Parameters

string $name: The attribute 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::hasAttribute()

File

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