Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldBlock.php

function FieldBlock::getEntity

Gets the entity that has the field.

Return value

\Drupal\Core\Entity\FieldableEntityInterface The entity.

3 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.
FieldBlock::entityFieldHasDefaultValue in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
Checks whether there is a default value set on the field.

File

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

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');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal