public function FieldFormatterEntityEmbedDisplayBase::getFieldDefinition in Entity Embed 8
Get the FieldDefinition object required to render this field's formatter.
Return value
\Drupal\Core\Field\BaseFieldDefinition The field definition.
See also
\Drupal\entity_embed\FieldFormatterEntityEmbedDisplayBase::build()
4 calls to FieldFormatterEntityEmbedDisplayBase::getFieldDefinition()
- EntityReferenceFieldFormatter::getFieldDefinition in src/
Plugin/ entity_embed/ EntityEmbedDisplay/ EntityReferenceFieldFormatter.php - Get the FieldDefinition object required to render this field's formatter.
- FieldFormatterEntityEmbedDisplayBase::build in src/
EntityEmbedDisplay/ FieldFormatterEntityEmbedDisplayBase.php - Builds the renderable array for this Entity Embed display plugin.
- FieldFormatterEntityEmbedDisplayBase::getFieldFormatter in src/
EntityEmbedDisplay/ FieldFormatterEntityEmbedDisplayBase.php - Constructs a field formatter.
- FieldFormatterEntityEmbedDisplayBase::isApplicableFieldFormatter in src/
EntityEmbedDisplay/ FieldFormatterEntityEmbedDisplayBase.php - Checks if the field formatter is applicable.
1 method overrides FieldFormatterEntityEmbedDisplayBase::getFieldDefinition()
- EntityReferenceFieldFormatter::getFieldDefinition in src/
Plugin/ entity_embed/ EntityEmbedDisplay/ EntityReferenceFieldFormatter.php - Get the FieldDefinition object required to render this field's formatter.
File
- src/
EntityEmbedDisplay/ FieldFormatterEntityEmbedDisplayBase.php, line 99
Class
- FieldFormatterEntityEmbedDisplayBase
- Base class for field formatter display plugins.
Namespace
Drupal\entity_embed\EntityEmbedDisplayCode
public function getFieldDefinition() {
if (!isset($this->fieldDefinition)) {
$field_type = $this
->getPluginDefinition()['field_type'];
$this->fieldDefinition = BaseFieldDefinition::create($field_type);
// Ensure the field name is unique for each Entity Embed Display plugin
// instance.
static $index = 0;
$this->fieldDefinition
->setName('_entity_embed_' . $index++);
}
return $this->fieldDefinition;
}