Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / src / Entity / EntityTestComputedField.php
1 <?php
2
3 namespace Drupal\entity_test\Entity;
4
5 use Drupal\Core\Entity\EntityTypeInterface;
6 use Drupal\Core\Field\BaseFieldDefinition;
7 use Drupal\entity_test\Plugin\Field\ComputedTestFieldItemList;
8
9 /**
10  * An entity used for testing computed field values.
11  *
12  * @ContentEntityType(
13  *   id = "entity_test_computed_field",
14  *   label = @Translation("Entity Test computed field"),
15  *   base_table = "entity_test_computed_field",
16  *   handlers = {
17  *     "views_data" = "Drupal\entity_test\EntityTestViewsData"
18  *   },
19  *   entity_keys = {
20  *     "id" = "id",
21  *     "label" = "name",
22  *   },
23  *   admin_permission = "administer entity_test content",
24  *   links = {
25  *     "add-form" = "/entity_test_computed_field/add",
26  *   },
27  * )
28  */
29 class EntityTestComputedField extends EntityTest {
30
31   /**
32    * {@inheritdoc}
33    */
34   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
35     $fields = parent::baseFieldDefinitions($entity_type);
36
37     $fields['computed_string_field'] = BaseFieldDefinition::create('string')
38       ->setLabel('Computed Field Test')
39       ->setComputed(TRUE)
40       ->setClass(ComputedTestFieldItemList::class);
41
42     return $fields;
43   }
44
45 }