You are here

protected function ComputedReferenceTestFieldItemList::computeValue in Drupal 8

Same name and namespace in other branches
  1. 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);
  }
}