config_test.module in Drupal 10
File
core/modules/config/tests/config_test/config_test.module
View source
<?php
require_once dirname(__FILE__) . '/config_test.hooks.inc';
function config_test_cache_flush() {
$GLOBALS['hook_cache_flush'] = __FUNCTION__;
}
function config_test_entity_type_alter(array &$entity_types) {
$entity_types['config_test']
->set('translatable', \Drupal::service('state')
->get('config_test.translatable'));
$entity_types['config_test_no_status'] = clone $entity_types['config_test'];
$config_test_no_status =& $entity_types['config_test_no_status'];
$config_test_no_status
->setLinkTemplate('edit-form', '/admin/structure/config_test/manage/{config_test_no_status}');
$config_test_no_status
->setLinkTemplate('delete-form', '/admin/structure/config_test/manage/{config_test_no_status}/delete');
$keys = $config_test_no_status
->getKeys();
unset($keys['status']);
$config_test_no_status
->set('id', 'config_test_no_status');
$config_test_no_status
->set('entity_keys', $keys);
$config_test_no_status
->set('config_prefix', 'no_status');
$config_test_no_status
->set('mergedConfigExport', [
'id' => 'id',
'label' => 'label',
'uuid' => 'uuid',
]);
if (\Drupal::service('state')
->get('config_test.lookup_keys', FALSE)) {
$entity_types['config_test']
->set('lookup_keys', [
'uuid',
'style',
]);
}
}