Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / src / Entity / EntityTestWithBundle.php
1 <?php
2
3 namespace Drupal\entity_test\Entity;
4
5 use Drupal\Core\Entity\ContentEntityBase;
6 use Drupal\Core\Entity\EntityTypeInterface;
7 use Drupal\Core\Field\BaseFieldDefinition;
8
9 /**
10  * Defines the Test entity with bundle entity class.
11  *
12  * @ContentEntityType(
13  *   id = "entity_test_with_bundle",
14  *   label = @Translation("Test entity with bundle"),
15  *   handlers = {
16  *     "list_builder" = "Drupal\entity_test\EntityTestListBuilder",
17  *     "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
18  *     "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
19  *     "form" = {
20  *       "default" = "\Drupal\Core\Entity\ContentEntityForm",
21  *       "delete" = "\Drupal\Core\Entity\EntityDeleteForm"
22  *     },
23  *     "route_provider" = {
24  *       "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
25  *     },
26  *   },
27  *   base_table = "entity_test_with_bundle",
28  *   admin_permission = "administer entity_test_with_bundle content",
29  *   persistent_cache = FALSE,
30  *   entity_keys = {
31  *     "id" = "id",
32  *     "uuid" = "uuid",
33  *     "bundle" = "type",
34  *     "label" = "name",
35  *     "langcode" = "langcode",
36  *   },
37  *   bundle_entity_type = "entity_test_bundle",
38  *   links = {
39  *     "canonical" = "/entity_test_with_bundle/{entity_test_with_bundle}",
40  *     "add-page" = "/entity_test_with_bundle/add",
41  *     "add-form" = "/entity_test_with_bundle/add/{entity_test_bundle}",
42  *     "edit-form" = "/entity_test_with_bundle/{entity_test_with_bundle}/edit",
43  *     "delete-form" = "/entity_test_with_bundle/{entity_test_with_bundle}/delete",
44  *     "create" = "/entity_test_with_bundle",
45  *   },
46  * )
47  */
48 class EntityTestWithBundle extends ContentEntityBase {
49
50   /**
51    * {@inheritdoc}
52    */
53   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
54     $fields = parent::baseFieldDefinitions($entity_type);
55
56     $fields['name'] = BaseFieldDefinition::create('string')
57       ->setLabel(t('Name'))
58       ->setDescription(t('The name of the test entity.'))
59       ->setTranslatable(TRUE)
60       ->setSetting('max_length', 32)
61       ->setDisplayOptions('view', [
62         'label' => 'hidden',
63         'type' => 'string',
64         'weight' => -5,
65       ])
66       ->setDisplayOptions('form', [
67         'type' => 'string_textfield',
68         'weight' => -5,
69       ]);
70     return $fields;
71   }
72
73 }