EntityModerationRouteProvider::getEntityTypeIdKeyType

protected EntityModerationRouteProvider::getEntityTypeIdKeyType(EntityTypeInterface $entity_type)

Gets the type of the ID key for a given entity type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: An entity type.

Return value

string|null The type of the ID key for a given entity type, or NULL if the entity type does not support fields.

File

core/modules/content_moderation/src/Routing/EntityModerationRouteProvider.php, line 113

Class

EntityModerationRouteProvider
Dynamic route provider for the Content moderation module.

Namespace

Drupal\content_moderation\Routing

Code

protected function getEntityTypeIdKeyType(EntityTypeInterface $entity_type) {
  if (!$entity_type->isSubclassOf(FieldableEntityInterface::class)) {
    return NULL;
  }

  $field_storage_definitions = $this->entityFieldManager->getFieldStorageDefinitions($entity_type->id());
  return $field_storage_definitions[$entity_type->getKey('id')]->getType();
}
doc_Drupal
2016-10-29 09:07:15
Comments
Leave a Comment

Please login to continue.