diff -u b/core/includes/common.inc b/core/includes/common.inc --- b/core/includes/common.inc +++ b/core/includes/common.inc @@ -2764,7 +2764,7 @@ if (!isset($libraries[$module])) { // Retrieve all libraries associated with the module. - $module_libraries = Drupal::moduleHandler()->invoke($module, 'library_info'); + $module_libraries = \Drupal::moduleHandler()->invoke($module, 'library_info'); if (empty($module_libraries)) { $module_libraries = array(); } @@ -3217,7 +3217,7 @@ foreach (\Drupal::moduleHandler()->getImplementations('cron') as $module) { // Do not let an exception thrown by one module disturb another. try { - Drupal::moduleHandler()->invoke($module, 'cron'); + \Drupal::moduleHandler()->invoke($module, 'cron'); } catch (Exception $e) { watchdog_exception('cron', $e); diff -u b/core/includes/install.inc b/core/includes/install.inc --- b/core/includes/install.inc +++ b/core/includes/install.inc @@ -651,7 +651,7 @@ \Drupal::service('config.installer')->installDefaultConfig('module', 'system'); - Drupal::moduleHandler()->invoke('system', 'install'); + \Drupal::moduleHandler()->invoke('system', 'install'); } /** @@ -1003,7 +1003,7 @@ function drupal_check_module($module) { module_load_install($module); // Check requirements - $requirements = Drupal::moduleHandler()->invoke($module, 'requirements', array('install')); + $requirements = \Drupal::moduleHandler()->invoke($module, 'requirements', array('install')); if (is_array($requirements) && drupal_requirements_severity($requirements) == REQUIREMENT_ERROR) { // Print any error messages foreach ($requirements as $requirement) { diff -u b/core/includes/mail.inc b/core/includes/mail.inc --- b/core/includes/mail.inc +++ b/core/includes/mail.inc @@ -150,10 +150,10 @@ } $message['headers'] = $headers; - // Build the e-mail (get subject and body, allow additional headers) by - // invoking hook_mail() on this module. We cannot use - // moduleHandler()->invoke() as we need to have $message by reference in - // hook_mail(). + // Build the e-mail (get subject and body, allow additional headers) + // by invoking hook_mail() on this module. We cannot use + // \Drupal::moduleHandler()->invoke() as we need to have $message + // by reference in hook_mail(). if (function_exists($function = $module . '_mail')) { $function($key, $message, $params); } diff -u b/core/includes/schema.inc b/core/includes/schema.inc --- b/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -85,7 +85,7 @@ // Cast the result of hook_schema() to an array, as a NULL return value // would cause array_merge() to set the $schema variable to NULL as well. // That would break modules which use $schema further down the line. - $current = (array) Drupal::moduleHandler()->invoke($module, 'schema'); + $current = (array) \Drupal::moduleHandler()->invoke($module, 'schema'); // Set 'module' and 'name' keys for each table, and remove descriptions, // as they needlessly slow down cache()->get() for every single request. _drupal_schema_initialize($current, $module); @@ -273,7 +273,7 @@ function drupal_get_schema_unprocessed($module, $table = NULL) { // Load the .install file to get hook_schema. module_load_install($module); - $schema = Drupal::moduleHandler()->invoke($module, 'schema'); + $schema = \Drupal::moduleHandler()->invoke($module, 'schema'); if (isset($table)) { if (isset($schema[$table])) { diff -u b/core/includes/update.inc b/core/includes/update.inc --- b/core/includes/update.inc +++ b/core/includes/update.inc @@ -990,9 +990,9 @@ // Otherwise, get the list of updates defined by this module. $updates = drupal_get_schema_versions($module); if ($updates !== FALSE) { - // module_invoke returns NULL for nonexisting hooks, so if no updates - // are removed, it will == 0. - $last_removed = Drupal::moduleHandler()->invoke($module, 'update_last_removed'); + // \Drupal::moduleHandler()->invoke returns NULL for nonexisting hooks, + // so if no updates are removed, it will == 0. + $last_removed = \Drupal::moduleHandler()->invoke($module, 'update_last_removed'); if ($schema_version < $last_removed) { $ret[$module]['warning'] = '' . $module . ' module can not be updated. Its schema version is ' . $schema_version . '. Updates up to and including ' . $last_removed . ' have been removed in this release. In order to update ' . $module . ' module, you will first need to upgrade to the last version in which these updates were available.'; continue; diff -u b/core/modules/file/file.module b/core/modules/file/file.module --- b/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -651,7 +651,9 @@ // Default to FALSE and let entities overrule this ruling. $grants = array('system' => FALSE); foreach (\Drupal::moduleHandler()->getImplementations('file_download_access') as $module) { - $grants = array_merge($grants, array($module => Drupal::moduleHandler()->invoke($module, 'file_download_access', array($field, $entity, $file)))); + $grants = array_merge($grants, array( + $module => \Drupal::moduleHandler()->invoke($module, 'file_download_access', array($field, $entity, $file)), + )); } // Allow other modules to alter the returned grants/denies. $context = array( diff -u b/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php --- b/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -100,7 +100,7 @@ '#default_value' => $node->getChangedTime(), ); - $language_configuration = \Drupal::moduleHandler()->invoke('language', 'get_default_configuration', 'node', $node->getType()); + $language_configuration = \Drupal::moduleHandler()->invoke('language', 'get_default_configuration', array('node', $node->getType())); $form['langcode'] = array( '#title' => t('Language'), '#type' => 'language_select', diff -u b/core/modules/search/search.module b/core/modules/search/search.module --- b/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -416,7 +416,7 @@ */ function search_invoke_preprocess(&$text, $langcode = NULL) { foreach (\Drupal::moduleHandler()->getImplementations('search_preprocess') as $module) { - $text = Drupal::moduleHandler()->invoke($module, 'search_preprocess', array($text, $langcode)); + $text = \Drupal::moduleHandler()->invoke($module, 'search_preprocess', array($text, $langcode)); } } diff -u b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php @@ -117,14 +117,14 @@ } /** - * Test that moduleHandler()->invoke() can load a hook defined in - * hook_hook_info(). + * Test that \Drupal::moduleHandler()->invoke() can load a hook + * defined in hook_hook_info(). */ function testModuleInvoke() { \Drupal::moduleHandler()->install(array('module_test'), FALSE); $this->resetAll(); $this->drupalGet('module-test/hook-dynamic-loading-invoke'); - $this->assertText('success!', 'moduleHandler()->invoke() dynamically loads a hook defined in hook_hook_info().'); + $this->assertText('success!', '\Drupal::moduleHandler()->invoke() dynamically loads a hook defined in hook_hook_info().'); } /** diff -u b/core/modules/system/system.module b/core/modules/system/system.module --- b/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2614,7 +2614,7 @@ $admin_tasks = array(); $titles = array(); - if ($menu = Drupal::moduleHandler()->invoke($module, 'menu')) { + if ($menu = \Drupal::moduleHandler()->invoke($module, 'menu')) { foreach ($menu as $path => $item) { if (isset($links[$path])) { $task = $links[$path]; diff -u b/core/modules/system/tests/modules/module_test/module_test.module b/core/modules/system/tests/modules/module_test/module_test.module --- b/core/modules/system/tests/modules/module_test/module_test.module +++ b/core/modules/system/tests/modules/module_test/module_test.module @@ -92,7 +92,7 @@ * @deprecated \Drupal\module_test\Controller\ModuleTestController::hookDynamicLoadingInvoke() */ function module_test_hook_dynamic_loading_invoke() { - $result = Drupal::moduleHandler()->invoke('module_test', 'test_hook'); + $result = \Drupal::moduleHandler()->invoke('module_test', 'test_hook'); return $result['module_test']; } diff -u b/core/modules/user/user.module b/core/modules/user/user.module --- b/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1517,7 +1517,7 @@ function user_permission_get_modules() { $permissions = array(); foreach (\Drupal::moduleHandler()->getImplementations('permission') as $module) { - $perms = Drupal::moduleHandler()->invoke($module, 'permission'); + $perms = \Drupal::moduleHandler()->invoke($module, 'permission'); foreach ($perms as $key => $value) { $permissions[$key] = $module; } @@ -1750,7 +1750,7 @@ if ($rid) { $permissions = array(); foreach ($modules as $module) { - if ($module_permissions = Drupal::moduleHandler()->invoke($module, 'permission')) { + if ($module_permissions = \Drupal::moduleHandler()->invoke($module, 'permission')) { $permissions = array_merge($permissions, array_keys($module_permissions)); } }