function _comment_entity_uses_integer_id
Same name in other branches
- 9 core/modules/comment/comment.module \_comment_entity_uses_integer_id()
- 8.9.x core/modules/comment/comment.module \_comment_entity_uses_integer_id()
- 11.x core/modules/comment/comment.module \_comment_entity_uses_integer_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.
3 calls to _comment_entity_uses_integer_id()
- CommentTypeForm::entityTypeSupportsComments in core/
modules/ comment/ src/ CommentTypeForm.php - Wraps _comment_entity_uses_integer_id().
- comment_field_info_entity_type_ui_definitions_alter in core/
modules/ comment/ comment.module - Implements hook_field_info_entity_type_ui_definitions_alter().
- comment_field_storage_config_insert in core/
modules/ comment/ comment.module - Implements hook_ENTITY_TYPE_insert() for 'field_storage_config'.
File
-
core/
modules/ comment/ comment.module, line 346
Code
function _comment_entity_uses_integer_id($entity_type_id) {
$entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
$entity_type_id_key = $entity_type->getKey('id');
if ($entity_type_id_key === FALSE) {
return FALSE;
}
$field_definitions = \Drupal::service('entity_field.manager')->getBaseFieldDefinitions($entity_type->id());
$entity_type_id_definition = $field_definitions[$entity_type_id_key];
return $entity_type_id_definition->getType() === 'integer';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.