Added missing modules, including some as submodules.
[yaffs-website] / web / modules / contrib / inline_entity_form / tests / modules / inline_entity_form_test / src / Entity / EntityTestWithoutBundle.php
1 <?php
2
3 namespace Drupal\inline_entity_form_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 a test entity class without bundles.
11  *
12  * @ContentEntityType(
13  *   id = "entity_test__without_bundle",
14  *   label = @Translation("Test entity without bundle"),
15  *   base_table = "entity_test__without_bundle",
16  *   admin_permission = "administer entity_test__without_bundle content",
17  *   entity_keys = {
18  *     "id" = "id",
19  *     "uuid" = "uuid",
20  *     "label" = "name",
21  *     "langcode" = "langcode",
22  *   },
23  *   handlers = {
24  *     "route_provider" = {
25  *       "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
26  *     },
27  *   },
28  *   links = {
29  *     "canonical" = "/entity_test__without_bundle/{entity_test__without_bundle}",
30  *   },
31  * )
32  */
33 class EntityTestWithoutBundle extends ContentEntityBase {
34
35   /**
36    * {@inheritdoc}
37    */
38   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
39     $fields = parent::baseFieldDefinitions($entity_type);
40
41     $fields['name'] = BaseFieldDefinition::create('string')
42       ->setLabel(t('Name'))
43       ->setDescription(t('The name of the test entity.'))
44       ->setTranslatable(TRUE)
45       ->setSetting('max_length', 32)
46       ->setDisplayOptions('view', [
47         'label' => 'hidden',
48         'type' => 'string',
49         'weight' => -5,
50       ])
51       ->setDisplayOptions('form', [
52         'type' => 'string_textfield',
53         'weight' => -5,
54       ]);
55     return $fields;
56   }
57
58 }