You are here

protected function ComputedReferenceTestFieldItemList::computeValue in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedReferenceTestFieldItemList.php \Drupal\entity_test\Plugin\Field\ComputedReferenceTestFieldItemList::computeValue()
  2. 9 core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedReferenceTestFieldItemList.php \Drupal\entity_test\Plugin\Field\ComputedReferenceTestFieldItemList::computeValue()

Compute the list property from state.

Overrides ComputedItemListTrait::computeValue

File

core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedReferenceTestFieldItemList.php, line 18

Class

ComputedReferenceTestFieldItemList
A computed entity reference field item list.

Namespace

Drupal\entity_test\Plugin\Field

Code

protected function computeValue() {
  foreach (\Drupal::state()
    ->get('entity_test_reference_computed_target_ids', []) as $delta => $id) {
    $this->list[$delta] = $this
      ->createItem($delta, $id);
  }
}