You are here

public function EntityReferenceFieldFormatter::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.

Overrides FieldFormatterEntityEmbedDisplayBase::getFieldDefinition

See also

\Drupal\entity_embed\FieldFormatterEntityEmbedDisplayBase::build()

1 call to EntityReferenceFieldFormatter::getFieldDefinition()
ViewModeFieldFormatter::getFieldFormatter in src/Plugin/entity_embed/EntityEmbedDisplay/ViewModeFieldFormatter.php
Constructs a field formatter.

File

src/Plugin/entity_embed/EntityEmbedDisplay/EntityReferenceFieldFormatter.php, line 93

Class

EntityReferenceFieldFormatter
Entity Embed Display reusing entity reference field formatters.

Namespace

Drupal\entity_embed\Plugin\entity_embed\EntityEmbedDisplay

Code

public function getFieldDefinition() {
  if (!isset($this->fieldDefinition)) {
    $this->fieldDefinition = parent::getFieldDefinition();
    $this->fieldDefinition
      ->setSetting('target_type', $this
      ->getEntityTypeFromContext());
  }
  return $this->fieldDefinition;
}