Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / entity_test.install
1 <?php
2
3 /**
4  * @file
5  * Install, update and uninstall functions for the entity_test module.
6  */
7
8 use Drupal\system\Tests\Update\DbUpdatesTrait;
9 use Drupal\field\Entity\FieldStorageConfig;
10 use Drupal\field\Entity\FieldConfig;
11
12 /**
13  * Implements hook_install().
14  */
15 function entity_test_install() {
16   foreach (entity_test_entity_types() as $entity_type) {
17     // Auto-create fields for testing.
18     FieldStorageConfig::create([
19       'entity_type' => $entity_type,
20       'field_name' => 'field_test_text',
21       'type' => 'text',
22       'cardinality' => 1,
23     ])->save();
24     FieldConfig::create([
25       'entity_type' => $entity_type,
26       'field_name' => 'field_test_text',
27       'bundle' => $entity_type,
28       'label' => 'Test text-field',
29       'translatable' => FALSE,
30     ])->save();
31
32     entity_get_form_display($entity_type, $entity_type, 'default')
33       ->setComponent('field_test_text', ['type' => 'text_textfield'])
34       ->save();
35   }
36 }
37
38 /**
39  * Implements hook_schema().
40  */
41 function entity_test_schema() {
42   // Schema for simple entity.
43   $schema['entity_test_example'] = [
44     'description' => 'Stores entity_test items.',
45     'fields' => [
46       'id' => [
47         'type' => 'serial',
48         'not null' => TRUE,
49         'description' => 'Primary Key: Unique entity-test item ID.',
50       ],
51     ],
52     'primary key' => ['id'],
53   ];
54   return $schema;
55 }
56
57 DbUpdatesTrait::includeUpdates('entity_test', 'entity_definition_updates');
58 DbUpdatesTrait::includeUpdates('entity_test', 'status_report');