class ComputedTestCacheableIntegerItemList
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedTestCacheableIntegerItemList.php \Drupal\entity_test\Plugin\Field\ComputedTestCacheableIntegerItemList
- 10 core/modules/system/tests/modules/entity_test/src/Plugin/Field/ComputedTestCacheableIntegerItemList.php \Drupal\entity_test\Plugin\Field\ComputedTestCacheableIntegerItemList
Item list class for computed cacheable string field.
This class sets the cacheable metadata on the field item list directly.
Hierarchy
- class \Drupal\Core\TypedData\TypedData implements \Drupal\Core\TypedData\TypedDataInterface, \Drupal\Component\Plugin\PluginInspectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\TypedData\TypedDataTrait
- class \Drupal\Core\TypedData\Plugin\DataType\ItemList implements \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ListInterface extends \Drupal\Core\TypedData\TypedData
- class \Drupal\Core\Field\FieldItemList implements \Drupal\Core\Field\FieldItemListInterface extends \Drupal\Core\TypedData\Plugin\DataType\ItemList
- class \Drupal\entity_test\Plugin\Field\ComputedTestCacheableIntegerItemList implements \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\Cache\CacheableDependencyTrait extends \Drupal\Core\Field\FieldItemList
- class \Drupal\Core\Field\FieldItemList implements \Drupal\Core\Field\FieldItemListInterface extends \Drupal\Core\TypedData\Plugin\DataType\ItemList
- class \Drupal\Core\TypedData\Plugin\DataType\ItemList implements \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ListInterface extends \Drupal\Core\TypedData\TypedData
Expanded class hierarchy of ComputedTestCacheableIntegerItemList
See also
\Drupal\entity_test\Plugin\Field\ComputedTestCacheableStringItemList
1 file declares its use of ComputedTestCacheableIntegerItemList
- EntityTestComputedField.php in core/
modules/ system/ tests/ modules/ entity_test/ src/ Entity/ EntityTestComputedField.php
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Plugin/ Field/ ComputedTestCacheableIntegerItemList.php, line 20
Namespace
Drupal\entity_test\Plugin\FieldView source
class ComputedTestCacheableIntegerItemList extends FieldItemList implements CacheableDependencyInterface {
use CacheableDependencyTrait, ComputedItemListTrait;
/**
* {@inheritdoc}
*/
protected function computeValue() {
$value = \Drupal::state()->get('entity_test_computed_integer_value', 0);
$item = $this->createItem(0, $value);
$cacheability = (new CacheableMetadata())->setCacheContexts([
'url.query_args:computed_test_cacheable_integer_field',
])
->setCacheTags([
'field:computed_test_cacheable_integer_field',
])
->setCacheMaxAge(31536000);
$this->setCacheability($cacheability);
$this->list[0] = $item;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.