Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Attribute.php

function 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 232

Class

Attribute
Collects, sanitizes, and renders HTML attributes.

Namespace

Drupal\Core\Template

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal