You are here

protected function FieldBlock::getFieldDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::getFieldDefinition()

Gets the field definition.

Return value

\Drupal\Core\Field\FieldDefinitionInterface The field definition.

3 calls to FieldBlock::getFieldDefinition()
FieldBlock::blockForm in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
FieldBlock::formatterSettingsProcessCallback in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
Render API callback: builds the formatter settings elements.
FieldBlock::getFormatter in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
Gets the formatter object.

File

core/modules/layout_builder/src/Plugin/Block/FieldBlock.php, line 347

Class

FieldBlock
Provides a block that renders a field from an entity.

Namespace

Drupal\layout_builder\Plugin\Block

Code

protected function getFieldDefinition() {
  if (empty($this->fieldDefinition)) {
    $field_definitions = $this->entityFieldManager
      ->getFieldDefinitions($this->entityTypeId, $this->bundle);
    $this->fieldDefinition = $field_definitions[$this->fieldName];
  }
  return $this->fieldDefinition;
}