_comment_entity_uses_integer_id($entity_type_id)
Determines if an entity type is using an integer-based ID definition.
Parameters
string $entity_type_id: The ID the represents the entity type.
Return value
bool Returns TRUE if the entity type has an integer-based ID definition and FALSE otherwise.
File
- core/modules/comment/comment.module, line 411
- Enables users to comment on published content.
Code
function _comment_entity_uses_integer_id($entity_type_id) { $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); $entity_type_id_key = $entity_type->getKey('id'); if ($entity_type_id_key === FALSE) { return FALSE; } $field_definitions = \Drupal::entityManager()->getBaseFieldDefinitions($entity_type->id()); $entity_type_id_definition = $field_definitions[$entity_type_id_key]; return $entity_type_id_definition->getType() === 'integer'; }
Please login to continue.