function FieldAPIHandlerTrait::getFieldDefinition
Same name in other branches
- 9 core/modules/views/src/FieldAPIHandlerTrait.php \Drupal\views\FieldAPIHandlerTrait::getFieldDefinition()
- 8.9.x core/modules/views/src/FieldAPIHandlerTrait.php \Drupal\views\FieldAPIHandlerTrait::getFieldDefinition()
- 10 core/modules/views/src/FieldAPIHandlerTrait.php \Drupal\views\FieldAPIHandlerTrait::getFieldDefinition()
Gets the field definition.
A View works on an entity type across bundles, and thus only has access to field storage definitions. In order to be able to use widgets and formatters, we create a generic field definition out of that storage definition.
Return value
\Drupal\Core\Field\FieldDefinitionInterface The field definition used by this handler.
See also
BaseFieldDefinition::createFromFieldStorageDefinition()
8 calls to FieldAPIHandlerTrait::getFieldDefinition()
- EntityField::access in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - Check whether given user has access to this handler.
- EntityField::addSelfTokens in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - Add any special tokens this field might use for itself.
- EntityField::buildOptionsForm in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - Default option form that provides label widget that all fields should have.
- EntityField::documentSelfTokens in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - Document any special tokens this field might use for itself.
- EntityField::getCacheTags in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - The cache tags associated with this object.
File
-
core/
modules/ views/ src/ FieldAPIHandlerTrait.php, line 46
Class
- FieldAPIHandlerTrait
- A trait containing helper methods for field definitions.
Namespace
Drupal\viewsCode
protected function getFieldDefinition() {
if (!$this->fieldDefinition) {
$field_storage_config = $this->getFieldStorageDefinition();
$this->fieldDefinition = BaseFieldDefinition::createFromFieldStorageDefinition($field_storage_config);
}
return $this->fieldDefinition;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.