You are here

function locale_test_system_info_alter in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/locale/tests/modules/locale_test/locale_test.module \locale_test_system_info_alter()
  2. 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
Simulate a custom module with a local po file.

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';
    }
  }
}