You are here

function system_rebuild_module_data in Drupal 8

Same name and namespace in other branches
  1. 7 modules/system/system.module \system_rebuild_module_data()

Rebuild, save, and return data about all currently available modules.

Return value

\Drupal\Core\Extension\Extension[] Array of all available modules and their data.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal::service('extension.list.module')->getList() instead. Note: use reset() only when you really need to rescan and rebuild the list.

See also

https://www.drupal.org/node/2709919

1 call to system_rebuild_module_data()
SystemFunctionsLegacyTest::testSystemRebuildModuleDataDeprecation in core/modules/system/tests/src/Kernel/SystemFunctionsLegacyTest.php
@expectedDeprecation system_rebuild_module_data() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead, you should use \Drupal::service("extension.list.module")->getList(). See https://www.drupal.org/node/2709919

File

core/modules/system/system.module, line 1019
Configuration system that lets administrators modify the workings of the site.

Code

function system_rebuild_module_data() {
  @trigger_error('system_rebuild_module_data() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead, you should use \\Drupal::service("extension.list.module")->getList(). See https://www.drupal.org/node/2709919', E_USER_DEPRECATED);
  return \Drupal::service('extension.list.module')
    ->reset()
    ->getList();
}