Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::hasKey()
  2. 9 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::hasKey()

Indicates if a given entity key exists.

Parameters

string $key: The name of the entity key to check.

Return value

bool TRUE if a given entity key exists, FALSE otherwise.

Overrides EntityTypeInterface::hasKey

1 call to EntityType::hasKey()
EntityType::isRevisionable in core/lib/Drupal/Core/Entity/EntityType.php
Indicates whether entities of this type have revision support.

File

core/lib/Drupal/Core/Entity/EntityType.php, line 417

Class

EntityType
Provides an implementation of an entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function hasKey($key) {
  $keys = $this
    ->getKeys();
  return !empty($keys[$key]);
}