function FieldBlock::getEntity

Same name in other branches
  1. 8.9.x core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::getEntity()
  2. 10 core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::getEntity()
  3. 11.x core/modules/layout_builder/src/Plugin/Block/FieldBlock.php \Drupal\layout_builder\Plugin\Block\FieldBlock::getEntity()

Gets the entity that has the field.

Return value

\Drupal\Core\Entity\FieldableEntityInterface The entity.

2 calls to FieldBlock::getEntity()
FieldBlock::blockAccess in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
Indicates whether the block should be shown.
FieldBlock::build in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
Builds and returns the renderable array for this block plugin.

File

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

Class

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

Namespace

Drupal\layout_builder\Plugin\Block

Code

protected function getEntity() {
    return $this->getContextValue('entity');
}

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