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

Gets a specific entity key.

Parameters

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

Return value

string|false The entity key, or FALSE if it does not exist.

Overrides EntityTypeInterface::getKey

See also

self::getKeys()

1 call to EntityType::getKey()
ConfigEntityType::getConstraints in core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php
Gets an array of validation constraints.

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function getKey($key) {
  $keys = $this
    ->getKeys();
  return $keys[$key] ?? FALSE;
}