function hook_system_info_alter
Same name in other branches
- 7.x modules/system/system.api.php \hook_system_info_alter()
- 9 core/lib/Drupal/Core/Extension/module.api.php \hook_system_info_alter()
- 8.9.x core/lib/Drupal/Core/Extension/module.api.php \hook_system_info_alter()
- 10 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 \Drupal\Core\Extension\ExtensionList::doList(). 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
16 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.
- advisory_feed_test_system_info_alter in core/
modules/ system/ tests/ modules/ advisory_feed_test/ advisory_feed_test.module - Implements hook_system_info_alter().
- 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().
- dependency_version_test_system_info_alter in core/
modules/ system/ tests/ modules/ dependency_version_test/ dependency_version_test.module - Implements hook_system_info_alter().
- deprecated_module_test_system_info_alter in core/
modules/ system/ tests/ modules/ deprecated_module_test/ deprecated_module_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().
1 invocation of hook_system_info_alter()
- ExtensionList::doList in core/
lib/ Drupal/ Core/ Extension/ ExtensionList.php - Builds the list of extensions.
File
-
core/
lib/ Drupal/ Core/ Extension/ module.api.php, line 156
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->getFileInfo()
->getMTime();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.