You are here

public function BaseFieldDefinition::getTargetEntityTypeId in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/BaseFieldDefinition.php \Drupal\Core\Field\BaseFieldDefinition::getTargetEntityTypeId()
  2. 10 core/lib/Drupal/Core/Field/BaseFieldDefinition.php \Drupal\Core\Field\BaseFieldDefinition::getTargetEntityTypeId()

Returns the ID of the entity type the field is attached to.

This method should not be confused with EntityInterface::getEntityTypeId() (configurable fields are config entities, and thus implement both interfaces):

Return value

string The entity type ID.

Overrides FieldDefinitionInterface::getTargetEntityTypeId

3 calls to BaseFieldDefinition::getTargetEntityTypeId()
BaseFieldDefinition::getConfig in core/lib/Drupal/Core/Field/BaseFieldDefinition.php
Gets an object that can be saved in configuration.
BaseFieldDefinition::getUniqueIdentifier in core/lib/Drupal/Core/Field/BaseFieldDefinition.php
Returns a unique identifier for the field.
BaseFieldDefinition::getUniqueStorageIdentifier in core/lib/Drupal/Core/Field/BaseFieldDefinition.php
Returns a unique identifier for the field storage.

File

core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 668

Class

BaseFieldDefinition
A class for defining entity fields.

Namespace

Drupal\Core\Field

Code

public function getTargetEntityTypeId() {
  return isset($this->definition['entity_type']) ? $this->definition['entity_type'] : NULL;
}