function LocaleTestHooks::systemInfoAlter

Implements hook_system_info_alter().

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

Attributes

#[Hook('system_info_alter')]

File

core/modules/locale/tests/modules/locale_test/src/Hook/LocaleTestHooks.php, line 26

Class

LocaleTestHooks
Hook implementations for locale_test.

Namespace

Drupal\locale_test\Hook

Code

public function systemInfoAlter(&$info, Extension $file, $type) : void {
  // 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.