diff --git a/core/authorize.php b/core/authorize.php index c533618..d204491 100644 --- a/core/authorize.php +++ b/core/authorize.php @@ -75,9 +75,9 @@ function authorize_access_allowed() { // display errors via the maintenance theme. $module_list['system'] = 'core/modules/system/system.module'; $module_list['user'] = 'core/modules/user/user.module'; -drupal_container()->get('module_handler')->setModuleList($module_list); -drupal_container()->get('module_handler')->load('system'); -drupal_container()->get('module_handler')->load('user'); +Drupal::moduleHandler()->setModuleList($module_list); +Drupal::moduleHandler()->load('system'); +Drupal::moduleHandler()->load('user'); // Initialize the language system. drupal_language_initialize(); diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index e1c15fe..47ce218 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -900,7 +900,7 @@ function drupal_get_filename($type, $name, $filename = NULL) { if (($container = drupal_container()) && $container->has('keyvalue') && function_exists('db_query')) { if ($type == 'module') { if (empty($files[$type])) { - $files[$type] = drupal_container()->get('module_handler')->getModuleList(); + $files[$type] = Drupal::moduleHandler()->getModuleList(); } if (isset($files[$type][$name])) { return $files[$type][$name]; @@ -1148,7 +1148,7 @@ function drupal_page_is_cacheable($allow_caching = NULL) { * @see bootstrap_hooks() */ function bootstrap_invoke_all($hook) { - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); foreach ($module_handler->getBootstrapModules() as $module) { $module_handler->load($module); module_invoke($module, $hook); @@ -1169,8 +1169,8 @@ function bootstrap_invoke_all($hook) { * TRUE if the item is loaded or has already been loaded. */ function drupal_load($type, $name) { - if ($type == 'module' && drupal_container()->get('module_handler')->moduleExists($name)) { - return drupal_container()->get('module_handler')->load($name); + if ($type == 'module' && Drupal::moduleHandler()->moduleExists($name)) { + return Drupal::moduleHandler()->load($name); } // Once a file is included this can't be reversed during a request so do not @@ -2418,7 +2418,7 @@ function _drupal_bootstrap_variables() { $conf = variable_initialize(isset($conf) ? $conf : array()); // Load bootstrap modules. require_once DRUPAL_ROOT . '/core/includes/module.inc'; - drupal_container()->get('module_handler')->loadBootstrapModules(); + Drupal::moduleHandler()->loadBootstrapModules(); } /** @@ -2450,12 +2450,12 @@ function drupal_container() { * Returns the list of enabled modules. * * @deprecated as of Drupal 8.0. Use - * drupal_container()->get('module_handler')->getModuleList(). + * Drupal::moduleHandler()->getModuleList(). * * @see \Drupal\Core\Extension\ModuleHandler::getModuleList() */ function module_list() { - $modules = array_keys(drupal_container()->get('module_handler')->getModuleList()); + $modules = array_keys(Drupal::moduleHandler()->getModuleList()); return array_combine($modules, $modules); } @@ -2463,19 +2463,19 @@ function module_list() { * Determines which modules are implementing a hook. * * @deprecated as of Drupal 8.0. Use - * drupal_container()->get('module_handler')->getImplementations($hook). + * Drupal::moduleHandler()->getImplementations($hook). * * @see \Drupal\Core\Extension\ModuleHandler::getImplementations() */ function module_implements($hook) { - return drupal_container()->get('module_handler')->getImplementations($hook); + return Drupal::moduleHandler()->getImplementations($hook); } /** * Invokes a hook in a particular module. * * @deprecated as of Drupal 8.0. Use - * drupal_container()->get('module_handler')->invoke($module, $hook, $args = array()). + * Drupal::moduleHandler()->invoke($module, $hook, $args = array()). * * @see \Drupal\Core\Extension\ModuleHandler::invoke() */ @@ -2483,14 +2483,14 @@ function module_invoke($module, $hook) { $args = func_get_args(); // Remove $module and $hook from the arguments. unset($args[0], $args[1]); - return drupal_container()->get('module_handler')->invoke($module, $hook, $args); + return Drupal::moduleHandler()->invoke($module, $hook, $args); } /** * Invokes a hook in all enabled modules that implement it. * * @deprecated as of Drupal 8.0. Use - * drupal_container()->get('module_handler')->invokeAll($hook). + * Drupal::moduleHandler()->invokeAll($hook). * * @see \Drupal\Core\Extension\ModuleHandler::invokeAll() */ @@ -2498,43 +2498,43 @@ function module_invoke_all($hook) { $args = func_get_args(); // Remove $hook from the arguments. array_shift($args); - return drupal_container()->get('module_handler')->invokeAll($hook, $args); + return Drupal::moduleHandler()->invokeAll($hook, $args); } /** * Passes alterable variables to specific hook_TYPE_alter() implementations. * * @deprecated as of Drupal 8.0. Use - * drupal_container()->get('module_handler')->alter($hook). + * Drupal::moduleHandler()->alter($hook). * * @see \Drupal\Core\Extension\ModuleHandler::alter() */ function drupal_alter($type, &$data, &$context1 = NULL, &$context2 = NULL) { - return drupal_container()->get('module_handler')->alter($type, $data, $context1, $context2); + return Drupal::moduleHandler()->alter($type, $data, $context1, $context2); } /** * Determines whether a given module exists. * * @deprecated as of Drupal 8.0. Use - * drupal_container()->get('module_handler')->moduleExists($hook). + * Drupal::moduleHandler()->moduleExists($hook). * * @see \Drupal\Core\Extension\ModuleHandler::moduleExists() */ function module_exists($module) { - return drupal_container()->get('module_handler')->moduleExists($module); + return Drupal::moduleHandler()->moduleExists($module); } /** * Determines whether a module implements a hook. * * @deprecated as of Drupal 8.0. Use - * drupal_container()->get('module_handler')->implementsHook($module, $hook). + * Drupal::moduleHandler()->implementsHook($module, $hook). * * @see \Drupal\Core\Extension\ModuleHandler::implementsHook() */ function module_hook($module, $hook) { - return drupal_container()->get('module_handler')->implementsHook($module, $hook); + return Drupal::moduleHandler()->implementsHook($module, $hook); } /** diff --git a/core/includes/common.inc b/core/includes/common.inc index 86fc44a..5f3ce53 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4878,7 +4878,7 @@ function _drupal_bootstrap_code() { require_once DRUPAL_ROOT . '/core/includes/entity.inc'; // Load all enabled modules - drupal_container()->get('module_handler')->loadAll(); + Drupal::moduleHandler()->loadAll(); // Make sure all stream wrappers are registered. file_get_stream_wrappers(); @@ -6392,7 +6392,7 @@ function drupal_flush_all_caches() { // Ensure that all modules that are currently supposed to be enabled are // actually loaded. - drupal_container()->get('module_handler')->loadAll(); + Drupal::moduleHandler()->loadAll(); // Update the list of bootstrap modules. // Allows developers to get new bootstrap hooks implementations registered diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index bb8f247..2538010 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -399,7 +399,7 @@ function install_begin_request(&$install_state) { require_once DRUPAL_ROOT . '/core/includes/ajax.inc'; - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); if (!$module_handler->moduleExists('system')) { // Override the module list with a minimal set of modules. $module_handler->setModuleList(array('system' => 'core/modules/system/system.module')); diff --git a/core/includes/install.inc b/core/includes/install.inc index 4fc640f..0fdfc9b 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -643,7 +643,7 @@ function drupal_install_system() { ->save(); // Update the module list to include it. - drupal_container()->get('module_handler')->setModuleList(array('system' => $system_path . '/system.module')); + Drupal::moduleHandler()->setModuleList(array('system' => $system_path . '/system.module')); config_install_default_config('module', 'system'); diff --git a/core/includes/menu.inc b/core/includes/menu.inc index e59615c..69caeb0 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -2051,7 +2051,7 @@ function menu_local_tasks($level = 0) { $data['tabs'] = $tabs; // Allow modules to dynamically add further tasks. - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); foreach ($module_handler->getImplementations('menu_local_tasks') as $module) { $function = $module . '_menu_local_tasks'; $function($data, $router_item, $root_path); diff --git a/core/includes/module.inc b/core/includes/module.inc index 99eac78..f28cffd 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -287,7 +287,7 @@ function module_enable($module_list, $enable_dependencies = TRUE) { $schema_store = drupal_container()->get('keyvalue')->get('system.schema'); $module_config = config('system.module'); $disabled_config = config('system.module.disabled'); - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); foreach ($module_list as $module) { // Only process modules that are not already enabled. // A module is only enabled if it is configured as enabled. Custom or @@ -463,7 +463,7 @@ function module_disable($module_list, $disable_dependents = TRUE) { $module_config = config('system.module'); $disabled_config = config('system.module.disabled'); - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); foreach ($module_list as $module) { // Only process modules that are enabled. // A module is only enabled if it is configured as enabled. Custom or @@ -663,7 +663,7 @@ function module_set_weight($module, $weight) { // Prepare the new module list, sorted by weight, including filenames. // @see module_enable() - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); $current_module_filenames = $module_handler->getModuleList(); $current_modules = array_fill_keys(array_keys($current_module_filenames), 0); $current_modules = module_config_sort(array_merge($current_modules, $module_config->get('enabled'))); diff --git a/core/includes/schema.inc b/core/includes/schema.inc index e599923..48d15c2 100644 --- a/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -77,7 +77,7 @@ function drupal_get_complete_schema($rebuild = FALSE) { else { $schema = array(); // Load the .install files to get hook_schema. - drupal_container()->get('module_handler')->loadAllIncludes('install'); + Drupal::moduleHandler()->loadAllIncludes('install'); require_once DRUPAL_ROOT . '/core/includes/common.inc'; // Invoke hook_schema for all modules. @@ -121,7 +121,7 @@ function drupal_get_schema_versions($module) { $updates = &drupal_static(__FUNCTION__, NULL); if (!isset($updates[$module])) { $updates = array(); - foreach (drupal_container()->get('module_handler')->getModuleList() as $loaded_module => $filename) { + foreach (Drupal::moduleHandler()->getModuleList() as $loaded_module => $filename) { $updates[$loaded_module] = array(); } diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 8d527df..53ff529 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -368,14 +368,14 @@ function _theme_load_registry($theme, $base_theme = NULL, $theme_engine = NULL, $registry = _theme_build_registry($theme, $base_theme, $theme_engine); // Only persist this registry if all modules are loaded. This assures a // complete set of theme hooks. - if (drupal_container()->get('module_handler')->isLoaded()) { + if (Drupal::moduleHandler()->isLoaded()) { _theme_save_registry($theme, $registry); } } return $registry; } else { - return new ThemeRegistry('theme_registry:runtime:' . $theme->name, 'cache', array('theme_registry' => TRUE), drupal_container()->get('module_handler')->isLoaded()); + return new ThemeRegistry('theme_registry:runtime:' . $theme->name, 'cache', array('theme_registry' => TRUE), Drupal::moduleHandler()->isLoaded()); } } @@ -547,7 +547,7 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { // Add all modules so they can intervene with their own variable // processors. This allows them to provide variable processors even // if they are not the owner of the current hook. - $prefixes = array_merge($prefixes, array_keys(drupal_container()->get('module_handler')->getModuleList())); + $prefixes = array_merge($prefixes, array_keys(Drupal::moduleHandler()->getModuleList())); } elseif ($type == 'theme_engine' || $type == 'base_theme_engine') { // Theme engines get an extra set that come before the normally @@ -643,7 +643,7 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) { _theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module)); } // Only cache this registry if all modules are loaded. - if (drupal_container()->get('module_handler')->isLoaded()) { + if (Drupal::moduleHandler()->isLoaded()) { cache()->set("theme_registry:build:modules", $cache, CacheBackendInterface::CACHE_PERMANENT, array('theme_registry' => TRUE)); } } @@ -964,7 +964,7 @@ function theme($hook, $variables = array()) { // If called before all modules are loaded, we do not necessarily have a full // theme registry to work with, and therefore cannot process the theme // request properly. See also _theme_load_registry(). - if (!drupal_container()->get('module_handler')->isLoaded() && !defined('MAINTENANCE_MODE')) { + if (!Drupal::moduleHandler()->isLoaded() && !defined('MAINTENANCE_MODE')) { throw new Exception(t('theme() may not be called until all modules are loaded.')); } diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 37775e6..04273aa 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -56,7 +56,7 @@ function _drupal_maintenance_theme() { // Ensure that system.module is loaded. if (!function_exists('_system_rebuild_theme_data')) { $module_list['system'] = 'core/modules/system/system.module'; - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); $module_handler->setModuleList($module_list); $module_handler->load('system'); } diff --git a/core/includes/update.inc b/core/includes/update.inc index 6aea70f..4e07ff8 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -354,7 +354,7 @@ function update_prepare_d8_bootstrap() { // Populate a fixed module list (again, why did it get lost?) to avoid // errors due to the drupal_alter() in _system_rebuild_module_data(). $module_list['system'] = 'core/modules/system/system.module'; - drupal_container()->get('module_handler')->setModuleList($module_list); + Drupal::moduleHandler()->setModuleList($module_list); $module_data = _system_rebuild_module_data(); // Migrate each extension into configuration, varying by the extension's @@ -384,7 +384,7 @@ function update_prepare_d8_bootstrap() { foreach (array_keys($sorted_modules) as $m) { $sorted_with_filenames[$m] = drupal_get_filename('module', $m); } - drupal_container()->get('module_handler')->setModuleList($sorted_with_filenames); + Drupal::moduleHandler()->setModuleList($sorted_with_filenames); $disabled_modules->save(); $theme_config->save(); $disabled_themes->save(); diff --git a/core/lib/Drupal/Core/Entity/Field/Type/Field.php b/core/lib/Drupal/Core/Entity/Field/Type/Field.php index 305fc1f..3f4be1e 100644 --- a/core/lib/Drupal/Core/Entity/Field/Type/Field.php +++ b/core/lib/Drupal/Core/Entity/Field/Type/Field.php @@ -158,7 +158,7 @@ public function access($operation = 'view', User $account = NULL) { // Invoke hook and collect grants/denies for field access from other // modules. Our default access flag is masked under the ':default' key. $grants = array(':default' => $access); - $hook_implementations = drupal_container()->get('module_handler')->getImplementations('entity_field_access'); + $hook_implementations = Drupal::moduleHandler()->getImplementations('entity_field_access'); foreach ($hook_implementations as $module) { $grants = array_merge($grants, array($module => module_invoke($module, 'entity_field_access', $operation, $this, $account))); } diff --git a/core/modules/breakpoint/breakpoint.install b/core/modules/breakpoint/breakpoint.install index cba7b1b..a419a9b 100644 --- a/core/modules/breakpoint/breakpoint.install +++ b/core/modules/breakpoint/breakpoint.install @@ -18,5 +18,5 @@ function breakpoint_enable() { _breakpoint_theme_enabled(array_keys($themes)); // Import breakpoints from modules. - _breakpoint_modules_enabled(array_keys(drupal_container()->get('module_handler')->getModuleList())); + _breakpoint_modules_enabled(array_keys(Drupal::moduleHandler()->getModuleList())); } diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index ae0020a..e65b0a7 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -360,7 +360,7 @@ function comment_views_data() { ), ); - if (drupal_container()->get('module_handler')->moduleExists('translation_entity')) { + if (Drupal::moduleHandler()->moduleExists('translation_entity')) { $data['comment']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for comments.'), diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 00b25b4..71aa273 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -533,7 +533,7 @@ function field_modules_disabled($modules) { function field_sync_field_status() { // Refresh the 'active' and 'storage_active' columns according to the current // set of enabled modules. - $modules = array_keys(drupal_container()->get('module_handler')->getModuleList()); + $modules = array_keys(Drupal::moduleHandler()->getModuleList()); foreach ($modules as $module_name) { field_associate_fields($module_name); } diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Derivative/Layout.php b/core/modules/layout/lib/Drupal/layout/Plugin/Derivative/Layout.php index c5d0dde..f313b5a 100644 --- a/core/modules/layout/lib/Drupal/layout/Plugin/Derivative/Layout.php +++ b/core/modules/layout/lib/Drupal/layout/Plugin/Derivative/Layout.php @@ -59,7 +59,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) { // Add all modules as possible layout providers. // @todo Inject the module handler. - foreach (drupal_container()->get('module_handler')->getModuleList() as $module => $filename) { + foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) { $available_layout_providers[$module] = array( 'type' => 'module', 'provider' => $module, diff --git a/core/modules/node/node.views.inc b/core/modules/node/node.views.inc index 7f19d43..4496c96 100644 --- a/core/modules/node/node.views.inc +++ b/core/modules/node/node.views.inc @@ -209,7 +209,7 @@ function node_views_data() { ); } - if (drupal_container()->get('module_handler')->moduleExists('translation_entity')) { + if (Drupal::moduleHandler()->moduleExists('translation_entity')) { $data['node']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for nodes.'), diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 3aeab60..07f4763 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -39,7 +39,7 @@ function testSetUp() { // Verify that specified $modules have been loaded. $this->assertTrue(function_exists('entity_test_permission'), "$module.module was loaded."); // Verify that there is a fixed module list. - $this->assertIdentical(array_keys(drupal_container()->get('module_handler')->getModuleList()), array($module)); + $this->assertIdentical(array_keys(\Drupal::moduleHandler()->getModuleList()), array($module)); $this->assertIdentical(module_implements('permission'), array($module)); // Verify that no modules have been installed. @@ -54,7 +54,7 @@ function testEnableModulesLoad() { // Verify that the module does not exist yet. $this->assertFalse(module_exists($module), "$module module not found."); - $list = array_keys(drupal_container()->get('module_handler')->getModuleList()); + $list = array_keys(\Drupal::moduleHandler()->getModuleList()); $this->assertFalse(in_array($module, $list), "$module module not found in the extension handler's module list."); $list = module_implements('permission'); $this->assertFalse(in_array($module, $list), "{$module}_permission() in module_implements() not found."); @@ -64,7 +64,7 @@ function testEnableModulesLoad() { // Verify that the module exists. $this->assertTrue(module_exists($module), "$module module found."); - $list = array_keys(drupal_container()->get('module_handler')->getModuleList()); + $list = array_keys(\Drupal::moduleHandler()->getModuleList()); $this->assertTrue(in_array($module, $list), "$module module found in the extension handler's module list."); $list = module_implements('permission'); $this->assertTrue(in_array($module, $list), "{$module}_permission() in module_implements() found."); @@ -79,7 +79,7 @@ function testEnableModulesInstall() { // Verify that the module does not exist yet. $this->assertFalse(module_exists($module), "$module module not found."); - $list = array_keys(drupal_container()->get('module_handler')->getModuleList()); + $list = array_keys(\Drupal::moduleHandler()->getModuleList()); $this->assertFalse(in_array($module, $list), "$module module not found in the extension handler's module list."); $list = module_implements('permission'); $this->assertFalse(in_array($module, $list), "{$module}_permission() in module_implements() not found."); @@ -93,7 +93,7 @@ function testEnableModulesInstall() { // Verify that the enabled module exists. $this->assertTrue(module_exists($module), "$module module found."); - $list = array_keys(drupal_container()->get('module_handler')->getModuleList()); + $list = array_keys(\Drupal::moduleHandler()->getModuleList()); $this->assertTrue(in_array($module, $list), "$module module found in the extension handler's module list."); $list = module_implements('permission'); $this->assertTrue(in_array($module, $list), "{$module}_permission() in module_implements() found."); diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php index 3de02ce..eb9d7d5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php @@ -103,7 +103,7 @@ function testModuleImplements() { // cache, as that is expected to happen implicitly by setting the module // list. This verifies that the hook implementation cache is cleared // whenever setModuleList() is called. - $module_handler = drupal_container()->get('module_handler'); + $module_handler = \Drupal::moduleHandler(); $module_handler->invokeAll('test'); // Make sure group include files are detected properly even when the file is diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php index b02d5ff..7913f96 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php @@ -37,7 +37,7 @@ public function testDisabledUpgrade() { $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); // Get enabled modules. - $enabled = drupal_container()->get('module_handler')->getModuleList(); + $enabled = \Drupal::moduleHandler()->getModuleList(); // Get all available modules. $available = system_rebuild_module_data(); // Filter out hidden test modules. diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php index 74c9923..b6117cf 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php @@ -283,8 +283,8 @@ protected function performUpgrade($register_errors = TRUE) { // Reload module list for modules that are enabled in the test database // but not on the test client. - drupal_container()->get('module_handler')->resetImplementations(); - drupal_container()->get('module_handler')->reload(); + \Drupal::moduleHandler()->resetImplementations(); + \Drupal::moduleHandler()->reload(); // Rebuild the container and all caches. $this->rebuildContainer(); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index dbdf6a5..52f2068 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1232,7 +1232,7 @@ function system_modules_submit($form, &$form_state) { // Gets list of modules prior to install process, unsets $form_state['storage'] // so we don't get redirected back to the confirmation form. - $pre_install_list = drupal_container()->get('module_handler')->getModuleList(); + $pre_install_list = Drupal::moduleHandler()->getModuleList(); unset($form_state['storage']); // Reverse the 'enable' list, to order dependencies before dependents. @@ -1244,7 +1244,7 @@ function system_modules_submit($form, &$form_state) { // Gets module list after install process, flushes caches and displays a // message if there are changes. - $post_install_list = drupal_container()->get('module_handler')->getModuleList(); + $post_install_list = Drupal::moduleHandler()->getModuleList(); if ($pre_install_list != $post_install_list) { drupal_flush_all_caches(); drupal_set_message(t('The configuration options have been saved.')); diff --git a/core/modules/system/system.install b/core/modules/system/system.install index a93a124..0e9368f 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -414,7 +414,7 @@ function system_requirements($phase) { ); // Check installed modules. - foreach (drupal_container()->get('module_handler')->getModuleList() as $module => $filename) { + foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) { $updates = drupal_get_schema_versions($module); if ($updates !== FALSE) { $default = drupal_get_installed_schema_version($module); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index c4304f4..cd474e8 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2817,7 +2817,7 @@ function system_get_info($type, $name = NULL) { $info = array(); if ($type == 'module') { $data = system_rebuild_module_data(); - foreach (drupal_container()->get('module_handler')->getModuleList() as $module => $filename) { + foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) { $info[$module] = $data[$module]->info; } } @@ -2960,7 +2960,7 @@ function system_rebuild_module_data() { $record->schema_version = SCHEMA_UNINSTALLED; $files[$module] = $record->filename; } - $modules = drupal_container()->get('module_handler')->buildModuleDependencies($modules); + $modules = Drupal::moduleHandler()->buildModuleDependencies($modules); $modules_cache = $modules; // Store filenames to allow system_list() and drupal_get_filename() to diff --git a/core/modules/taxonomy/taxonomy.views.inc b/core/modules/taxonomy/taxonomy.views.inc index 0644f82..052c2ec 100644 --- a/core/modules/taxonomy/taxonomy.views.inc +++ b/core/modules/taxonomy/taxonomy.views.inc @@ -177,7 +177,7 @@ function taxonomy_views_data() { ); // Entity translation field. - if (drupal_container()->get('module_handler')->moduleExists('translation_entity')) { + if (Drupal::moduleHandler()->moduleExists('translation_entity')) { $data['taxonomy_term_data']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for taxonomy terms.'), diff --git a/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php index 12ca122..16e07f6 100644 --- a/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php +++ b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php @@ -123,7 +123,7 @@ public function getTips() { return ($a->getWeight() < $b->getWeight()) ? -1 : 1; }); - drupal_container()->get('module_handler')->alter('tour_tips', $tips, $this); + \Drupal::moduleHandler()->alter('tour_tips', $tips, $this); return array_values($tips); } diff --git a/core/modules/user/user.views.inc b/core/modules/user/user.views.inc index 11871c9..335f7b8 100644 --- a/core/modules/user/user.views.inc +++ b/core/modules/user/user.views.inc @@ -279,7 +279,7 @@ function user_views_data() { ), ); - if (drupal_container()->get('module_handler')->moduleExists('translation_entity')) { + if (Drupal::moduleHandler()->moduleExists('translation_entity')) { $data['users']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for users.'), diff --git a/core/scripts/dump-database-d6.sh b/core/scripts/dump-database-d6.sh index 106568d..89619ea 100644 --- a/core/scripts/dump-database-d6.sh +++ b/core/scripts/dump-database-d6.sh @@ -44,7 +44,7 @@ ENDOFHEADER; -foreach (drupal_container()->get('module_handler')->getModuleList() as $module => $filename) { +foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) { $output .= " * - $module\n"; } $output .= " */\n\n"; diff --git a/core/scripts/dump-database-d7.sh b/core/scripts/dump-database-d7.sh index 3b8597d..c4a0752 100644 --- a/core/scripts/dump-database-d7.sh +++ b/core/scripts/dump-database-d7.sh @@ -45,7 +45,7 @@ ENDOFHEADER; -foreach (drupal_container()->get('module_handler')->getModuleList() as $module => $filename) { +foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) { $output .= " * - $module\n"; } $output .= " */\n\n"; diff --git a/core/update.php b/core/update.php index e56d085..befb035 100644 --- a/core/update.php +++ b/core/update.php @@ -329,7 +329,7 @@ function update_access_allowed() { // Calls to user_access() might fail during the Drupal 6 to 7 update process, // so we fall back on requiring that the user be logged in as user #1. try { - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); $module_filenames = $module_handler->getModuleList(); $module_filenames['user'] = 'core/modules/user/user.module'; $module_handler->setModuleList($module_filenames); @@ -437,7 +437,7 @@ function update_check_requirements($skip_warnings = FALSE) { // Load module basics. include_once DRUPAL_ROOT . '/core/includes/module.inc'; $module_list['system'] = 'core/modules/system/system.module'; - $module_handler = drupal_container()->get('module_handler'); + $module_handler = Drupal::moduleHandler(); $module_handler->setModuleList($module_list); $module_handler->load('system');