function ComputedReferenceTestFieldItemList::computeValue

Same name in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedReferenceTestFieldItemList.php \Drupal\entity_test\Plugin\Field\ComputedReferenceTestFieldItemList::computeValue()
  2. 10 core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedReferenceTestFieldItemList.php \Drupal\entity_test\Plugin\Field\ComputedReferenceTestFieldItemList::computeValue()
  3. 11.x 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);
    }
}

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