You are here

public function LayoutSectionItemList::getEntity in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Field/LayoutSectionItemList.php \Drupal\layout_builder\Field\LayoutSectionItemList::getEntity()
  2. 9 core/modules/layout_builder/src/Field/LayoutSectionItemList.php \Drupal\layout_builder\Field\LayoutSectionItemList::getEntity()

Gets the entity that field belongs to.

Return value

\Drupal\Core\Entity\FieldableEntityInterface The entity object. If the entity is translatable and a specific translation is required, always request it by calling ::getTranslation() or ::getUntranslated() as the language of the returned object is not defined.

Overrides FieldItemList::getEntity

File

core/modules/layout_builder/src/Field/LayoutSectionItemList.php, line 61

Class

LayoutSectionItemList
Defines an item list class for layout section fields.

Namespace

Drupal\layout_builder\Field

Code

public function getEntity() {
  $entity = parent::getEntity();

  // Ensure the entity is updated with the latest value.
  $entity
    ->set($this
    ->getName(), $this
    ->getValue());
  return $entity;
}