5 * Provides Config module hook implementations for testing purposes.
8 require_once dirname(__FILE__) . '/config_test.hooks.inc';
11 * Implements hook_cache_flush().
13 function config_test_cache_flush() {
14 // Set a global value we can check in test code.
15 $GLOBALS['hook_cache_flush'] = __FUNCTION__;
19 * Implements hook_entity_type_alter().
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'));
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');
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']);