function FieldDefinitionInterface::getTargetBundle
Same name in other branches
- 9 core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::getTargetBundle()
- 8.9.x core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::getTargetBundle()
- 10 core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::getTargetBundle()
Gets the bundle the field is attached to.
This method should not be confused with EntityInterface::bundle() (configurable fields are config entities, and thus implement both interfaces):
- FieldDefinitionInterface::getTargetBundle() answers "as a field, which bundle are you attached to?".
- EntityInterface::bundle() answers "as a (config) entity, what is your own bundle?" (not relevant in our case, the config entity types used to store the definitions of configurable fields do not have bundles).
Return value
string|null The bundle the field is defined for, or NULL if it is a base field; i.e., it is not bundle-specific.
3 methods override FieldDefinitionInterface::getTargetBundle()
- BaseFieldDefinition::getTargetBundle in core/
lib/ Drupal/ Core/ Field/ BaseFieldDefinition.php - Gets the bundle the field is attached to.
- FieldConfigBase::getTargetBundle in core/
lib/ Drupal/ Core/ Field/ FieldConfigBase.php - Gets the bundle the field is attached to.
- FieldDefinition::getTargetBundle in core/
lib/ Drupal/ Core/ Field/ FieldDefinition.php - Gets the bundle the field is attached to.
File
-
core/
lib/ Drupal/ Core/ Field/ FieldDefinitionInterface.php, line 107
Class
- FieldDefinitionInterface
- Defines an interface for entity field definitions.
Namespace
Drupal\Core\FieldCode
public function getTargetBundle();
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.