public static function DynamicEntityReferenceItem::entityHasIntegerId in Dynamic Entity Reference 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldType/DynamicEntityReferenceItem.php \Drupal\dynamic_entity_reference\Plugin\Field\FieldType\DynamicEntityReferenceItem::entityHasIntegerId()
Determines if an entity type has 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.
5 calls to DynamicEntityReferenceItem::entityHasIntegerId()
- DynamicEntityReferenceItem::getTargetTypes in src/
Plugin/ Field/ FieldType/ DynamicEntityReferenceItem.php - Helper function to get all the entity type ids that can be referenced.
- DynamicEntityReferenceItem::storageSettingsForm in src/
Plugin/ Field/ FieldType/ DynamicEntityReferenceItem.php - Returns a form for the storage-level settings.
- DynamicEntityReferenceItem::storageSettingsFormValidate in src/
Plugin/ Field/ FieldType/ DynamicEntityReferenceItem.php - Form element validation for storage settings.
- DynamicEntityReferenceTest::testFieldSettings in tests/
src/ Functional/ DynamicEntityReferenceTest.php - Tests field settings of dynamic entity reference field.
- ValidDynamicReferenceConstraintValidator::validate in src/
Plugin/ Validation/ Constraint/ ValidDynamicReferenceConstraintValidator.php - Checks if the passed value is valid.
File
- src/
Plugin/ Field/ FieldType/ DynamicEntityReferenceItem.php, line 673
Class
- DynamicEntityReferenceItem
- Defines the 'dynamic_entity_reference' entity field type.
Namespace
Drupal\dynamic_entity_reference\Plugin\Field\FieldTypeCode
public static function entityHasIntegerId($entity_type_id) {
$entity_type = \Drupal::entityTypeManager()
->getDefinition($entity_type_id);
// Make sure entity type is a content entity type.
if (!$entity_type instanceof ContentEntityTypeInterface) {
return FALSE;
}
// Make sure entity type has an id.
if (!$entity_type
->hasKey('id')) {
return FALSE;
}
/** @var \Drupal\Core\Field\FieldDefinitionInterface[] $field_definitions */
$field_definitions = \Drupal::service('entity_field.manager')
->getBaseFieldDefinitions($entity_type_id);
$entity_type_id_definition = $field_definitions[$entity_type
->getKey('id')];
return $entity_type_id_definition
->getType() === 'integer';
}