Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / config / tests / config_test / config_test.module
1 <?php
2
3 /**
4  * @file
5  * Provides Config module hook implementations for testing purposes.
6  */
7
8 require_once dirname(__FILE__) . '/config_test.hooks.inc';
9
10 /**
11  * Implements hook_cache_flush().
12  */
13 function config_test_cache_flush() {
14   // Set a global value we can check in test code.
15   $GLOBALS['hook_cache_flush'] = __FUNCTION__;
16 }
17
18 /**
19  * Implements hook_entity_type_alter().
20  */
21 function config_test_entity_type_alter(array &$entity_types) {
22   /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
23   // The 'translatable' entity key is not supposed to change over time. In this
24   // case we can safely do it because we set it once and we do not change it for
25   // all the duration of the test session.
26   $entity_types['config_test']->set('translatable', \Drupal::service('state')->get('config_test.translatable'));
27
28   // Create a clone of config_test that does not have a status.
29   $entity_types['config_test_no_status'] = clone $entity_types['config_test'];
30   $config_test_no_status = &$entity_types['config_test_no_status'];
31   $config_test_no_status->setLinkTemplate('edit-form', '/admin/structure/config_test/manage/{config_test_no_status}');
32   $config_test_no_status->setLinkTemplate('delete-form', '/admin/structure/config_test/manage/{config_test_no_status}/delete');
33
34   $keys = $config_test_no_status->getKeys();
35   unset($keys['status']);
36   $config_test_no_status->set('id', 'config_test_no_status');
37   $config_test_no_status->set('entity_keys', $keys);
38   $config_test_no_status->set('config_prefix', 'no_status');
39   if (\Drupal::service('state')->get('config_test.lookup_keys', FALSE)) {
40     $entity_types['config_test']->set('lookup_keys', ['uuid', 'style']);
41   }
42 }