Example #1
0
/**
 * 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.
 *
 * @param array $info
 *   The .info.yml file contents, passed by reference so that it can be altered.
 * @param \Drupal\Core\Extension\Extension $file
 *   Full information about the module or theme.
 * @param string $type
 *   Either 'module' or 'theme', depending on the type of .info.yml file that
 *   was passed.
 */
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();
    }
}