function hook_registry_files_alter

Perform necessary alterations to the list of files parsed by the registry.

Modules can manually modify the list of files before the registry parses them. The $modules array provides the .info file information, which includes the list of files registered to each module. Any files in the list can then be added to the list of files that the registry will parse, or modify attributes of a file.

A necessary alteration made by the core SimpleTest module is to force .test files provided by disabled modules into the list of files parsed by the registry.


$files: List of files to be parsed by the registry. The list will contain files found in each enabled module's info file and the core includes directory. The array is keyed by the file path and contains an array of the related module's name and weight as used internally by _registry_update() and related functions.

For example:

$files["modules/system/system.module"] = array(
  'module' => 'system',
  'weight' => 0,

$modules: An array containing all module information stored in the {system} table. Each element of the array also contains the module's .info file information in the property 'info'. An additional 'dir' property has been added to the module information which provides the path to the directory in which the module resides. The example shows how to take advantage of both properties.

See also



Related topics

2 functions implement hook_registry_files_alter()

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

drupal_autoload_test_registry_files_alter in drupal/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.module
Implements hook_registry_files_alter().
simpletest_registry_files_alter in drupal/modules/simpletest/simpletest.module
Implements hook_registry_files_alter().
1 invocation of hook_registry_files_alter()
_registry_update in drupal/includes/
Does the work for registry_update().


drupal/modules/system/system.api.php, line 3712
Hooks provided by Drupal core and the System module.


function hook_registry_files_alter(&$files, $modules) {
  foreach ($modules as $module) {

    // Only add test files for disabled modules, as enabled modules should
    // already include any test files they provide.
    if (!$module->status) {
      $dir = $module->dir;
      foreach ($module->info['files'] as $file) {
        if (substr($file, -5) == '.test') {
          $files["{$dir}/{$file}"] = array(
            'module' => $module->name,
            'weight' => $module->weight,