public function Attribute::hasAttribute in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Template/Attribute.php \Drupal\Core\Template\Attribute::hasAttribute()
- 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\TemplateCode
public function hasAttribute($name) {
return array_key_exists($name, $this->storage);
}