You are here

public function Attribute::hasAttribute in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Template/Attribute.php \Drupal\Core\Template\Attribute::hasAttribute()
  2. 9 core/lib/Drupal/Core/Template/Attribute.php \Drupal\Core\Template\Attribute::hasAttribute()

Checks if the storage has an attribute with the given name.

Parameters

string $name: The name of the attribute to check for.

Return value

bool Returns TRUE if the attribute exists, or FALSE otherwise.

File

core/lib/Drupal/Core/Template/Attribute.php, line 228

Class

Attribute
Collects, sanitizes, and renders HTML attributes.

Namespace

Drupal\Core\Template

Code

public function hasAttribute($name) {
  return array_key_exists($name, $this->storage);
}