function FieldBlock::getFieldDefinition

Same name in other branches
  1. 9 core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::getFieldDefinition()
  2. 10 core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::getFieldDefinition()
  3. 11.x 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.