function locale_test_system_info_alter

Same name and namespace in other branches
  1. 9 core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_system_info_alter()
  2. 8.9.x core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_system_info_alter()
  3. 10 core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_system_info_alter()

Implements hook_system_info_alter().

Make the test scripts to be believe this is not a hidden test module, but a regular custom module.

File

core/modules/locale/tests/modules/locale_test/locale_test.module, line 18

Code

function locale_test_system_info_alter(&$info, Extension $file, $type) {
    // Only modify the system info if required.
    // By default the locale_test modules are hidden and have a project specified.
    // To test the module detection process by locale_project_list() the
    // test modules should mimic a custom module. I.e. be non-hidden.
    if (\Drupal::state()->get('locale.test_system_info_alter')) {
        if ($file->getName() == 'locale_test' || $file->getName() == 'locale_test_translate') {
            // Don't hide the module.
            $info['hidden'] = FALSE;
        }
    }
    // Alter the name and the core version of the project. This should not affect
    // the locale project information.
    if (\Drupal::state()->get('locale.test_system_info_alter_name_core')) {
        if ($file->getName() == 'locale_test') {
            $info['core'] = '8.6.7';
            $info['name'] = 'locale_test_alter';
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.