You are here

function hook_system_info_alter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Extension/module.api.php \hook_system_info_alter()

Alter the information parsed from module and theme .info.yml files.

This hook is invoked in _system_rebuild_module_data() and in \Drupal\Core\Extension\ThemeHandlerInterface::rebuildThemeData(). A module may implement this hook in order to add to or alter the data generated by reading the .info.yml file with \Drupal\Core\Extension\InfoParser.

Using implementations of this hook to make modules required by setting the $info['required'] key is discouraged. Doing so will slow down the module installation and uninstallation process. Instead, use \Drupal\Core\Extension\ModuleUninstallValidatorInterface.

Parameters

array $info: The .info.yml file contents, passed by reference so that it can be altered.

\Drupal\Core\Extension\Extension $file: Full information about the module or theme.

string $type: Either 'module' or 'theme', depending on the type of .info.yml file that was passed.

See also

\Drupal\Core\Extension\ModuleUninstallValidatorInterface

Related topics

11 functions implement hook_system_info_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

config_translation_test_system_info_alter in core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module
Implements hook_system_info_alter().
locale_test_development_release_system_info_alter in core/modules/locale/tests/modules/locale_test_development_release/locale_test_development_release.module
Implements hook_system_info_alter().
locale_test_system_info_alter in core/modules/locale/tests/modules/locale_test/locale_test.module
Implements hook_system_info_alter().
locale_test_translate_system_info_alter in core/modules/locale/tests/modules/locale_test_translate/locale_test_translate.module
Implements hook_system_info_alter().
module_required_test_system_info_alter in core/modules/system/tests/modules/module_required_test/module_required_test.module
Implements hook_system_info_alter().

... See full list

2 invocations of hook_system_info_alter()
ThemeHandler::rebuildThemeData in core/lib/Drupal/Core/Extension/ThemeHandler.php
Scans and collects theme extension data and their engines.
_system_rebuild_module_data in core/modules/system/system.module
Helper function to scan and collect module .info.yml data.

File

core/lib/Drupal/Core/Extension/module.api.php, line 155
Hooks related to module and update systems.

Code

function hook_system_info_alter(array &$info, \Drupal\Core\Extension\Extension $file, $type) {

  // Only fill this in if the .info.yml file does not define a 'datestamp'.
  if (empty($info['datestamp'])) {
    $info['datestamp'] = $file
      ->getMTime();
  }
}