From 77b0fe78db2fe064dc63e56971c4304839a1cce4 Mon Sep 17 00:00:00 2001
From: Michael Lander <mikegfx@gmail.com>
Date: Fri, 19 Jul 2013 21:36:12 -0600
Subject: : Generated with Drush iq

---
 core/includes/ajax.inc                             |    4 ++--
 core/includes/common.inc                           |   18 +++++++++---------
 core/includes/entity.inc                           |    6 +++---
 core/includes/file.inc                             |    4 ++--
 core/includes/file.mimetypes.inc                   |    2 +-
 core/includes/form.inc                             |    4 ++--
 core/includes/language.inc                         |    8 ++++----
 core/includes/mail.inc                             |    2 +-
 core/includes/menu.inc                             |   10 +++++-----
 core/includes/path.inc                             |    2 +-
 core/includes/schema.inc                           |    2 +-
 core/includes/theme.inc                            |    4 ++--
 core/lib/Drupal/Core/Ajax/AjaxResponse.php         |    4 ++--
 core/lib/Drupal/Core/Database/Query/Select.php     |    2 +-
 .../Drupal/Core/Entity/EntityRenderController.php  |    6 +++---
 core/lib/Drupal/Core/Entity/Field/Field.php        |    2 +-
 .../Core/Plugin/Discovery/AlterDecorator.php       |    2 +-
 core/lib/Drupal/Core/Session/UserSession.php       |    2 +-
 .../Core/Transliteration/PHPTransliteration.php    |    2 +-
 .../lib/Drupal/block/BlockRenderController.php     |    2 +-
 .../lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php |    2 +-
 core/modules/contextual/contextual.module          |    2 +-
 .../edit/lib/Drupal/edit/Form/EditFieldForm.php    |    2 +-
 .../Drupal/editor/Plugin/Core/Entity/Editor.php    |    2 +-
 .../lib/Drupal/editor/Plugin/EditorManager.php     |    2 +-
 .../entity_reference/selection/SelectionBase.php   |    2 +-
 core/modules/field/field.attach.inc                |    4 ++--
 core/modules/field/field.info.inc                  |    2 +-
 core/modules/field/field.module                    |    2 +-
 core/modules/field/field.multilingual.inc          |    4 ++--
 core/modules/field/lib/Drupal/field/FieldInfo.php  |    2 +-
 .../Drupal/field/Plugin/Type/Widget/WidgetBase.php |    2 +-
 .../lib/Drupal/field_ui/DisplayOverview.php        |    4 ++--
 .../lib/Drupal/field_ui/FormDisplayOverview.php    |    4 ++--
 core/modules/file/file.module                      |    2 +-
 core/modules/image/image.module                    |    2 +-
 core/modules/locale/locale.compare.inc             |    2 +-
 .../Drupal/node/Tests/NodeAccessRecordsTest.php    |    2 +-
 core/modules/node/node.module                      |    2 +-
 core/modules/simpletest/simpletest.module          |    2 +-
 .../lib/Drupal/system/Tests/Common/AlterTest.php   |    8 ++++----
 core/modules/system/system.admin.inc               |    2 +-
 core/modules/system/system.module                  |    4 ++--
 .../tests/modules/theme_test/theme_test.module     |    2 +-
 core/modules/toolbar/toolbar.module                |    2 +-
 .../lib/Drupal/tour/Plugin/Core/Entity/Tour.php    |    2 +-
 core/modules/update/update.compare.inc             |    4 ++--
 .../lib/Drupal/user/Plugin/Core/Entity/User.php    |    2 +-
 core/modules/user/user.pages.inc                   |    2 +-
 .../lib/Drupal/views/Plugin/views/HandlerBase.php  |    2 +-
 .../lib/Drupal/views_ui/ViewEditFormController.php |    4 ++--
 .../views_ui/lib/Drupal/views_ui/ViewUI.php        |    2 +-
 core/modules/xmlrpc/xmlrpc.server.inc              |    2 +-
 53 files changed, 87 insertions(+), 87 deletions(-)

diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc
index 8e024a8..d57fa5f 100644
--- a/core/includes/ajax.inc
+++ b/core/includes/ajax.inc
@@ -246,7 +246,7 @@ function ajax_render($commands = array()) {
     else {
       $function = 'drupal_add_' . $type;
       $items[$type] = $function();
-      drupal_alter($type, $items[$type]);
+      Drupal::moduleHandler()->alter($type, $items[$type]);
       // @todo Inline CSS and JS items are indexed numerically. These can't be
       //   reliably diffed with array_diff_key(), since the number can change
       //   due to factors unrelated to the inline content, so for now, we strip
@@ -296,7 +296,7 @@ function ajax_render($commands = array()) {
   }

   // Allow modules to alter any Ajax response.
-  drupal_alter('ajax_render', $commands);
+  Drupal::moduleHandler()->alter('ajax_render', $commands);

   return drupal_json_encode($commands);
 }
diff --git a/core/includes/common.inc b/core/includes/common.inc
index a4805c0..10638c0 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -372,7 +372,7 @@ function _drupal_default_html_head() {
  */
 function drupal_get_html_head() {
   $elements = drupal_add_html_head();
-  drupal_alter('html_head', $elements);
+  Drupal::moduleHandler()->alter('html_head', $elements);
   return drupal_render($elements);
 }

@@ -1706,7 +1706,7 @@ function drupal_get_css($css = NULL, $skip_alter = FALSE) {

   // Allow modules and themes to alter the CSS items.
   if (!$skip_alter) {
-    drupal_alter('css', $css);
+    Drupal::moduleHandler()->alter('css', $css);
   }

   // Sort CSS items, so that they appear in the correct order.
@@ -2321,7 +2321,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS

   // Allow modules to alter the JavaScript.
   if (!$skip_alter) {
-    drupal_alter('js', $javascript);
+    Drupal::moduleHandler()->alter('js', $javascript);
   }

   // Filter out elements of the given scope.
@@ -2824,7 +2824,7 @@ function drupal_get_library($module, $name = NULL) {
       $module_libraries = array();
     }
     // Allow modules to alter the module's registered libraries.
-    drupal_alter('library_info', $module_libraries, $module);
+    Drupal::moduleHandler()->alter('library_info', $module_libraries, $module);

     foreach ($module_libraries as $key => $data) {
       if (is_array($data)) {
@@ -3230,7 +3230,7 @@ function drupal_cron_run() {
   $return = FALSE;
   // Grab the defined cron queues.
   $queues = module_invoke_all('queue_info');
-  drupal_alter('queue_info', $queues);
+  Drupal::moduleHandler()->alter('queue_info', $queues);

   // Try to acquire cron lock.
   if (!lock()->acquire('cron', 240.0)) {
@@ -3643,7 +3643,7 @@ function drupal_render_page($page) {
   }
   // Modules alter the $page as needed. Blocks are populated into regions like
   // 'sidebar_first', 'footer', etc.
-  drupal_alter('page', $page);
+  Drupal::moduleHandler()->alter('page', $page);

   // If no module has taken care of the main content, add it to the page now.
   // This allows the site to still be usable even if no modules that
@@ -4280,7 +4280,7 @@ function element_info($type) {
       $cache[$element_type]['#type'] = $element_type;
     }
     // Allow modules to alter the element type defaults.
-    drupal_alter('element_info', $cache);
+    Drupal::moduleHandler()->alter('element_info', $cache);
   }

   return isset($cache[$type]) ? $cache[$type] : array();
@@ -4829,7 +4829,7 @@ function drupal_get_updaters() {
   $updaters = &drupal_static(__FUNCTION__);
   if (!isset($updaters)) {
     $updaters = module_invoke_all('updater_info');
-    drupal_alter('updater_info', $updaters);
+    Drupal::moduleHandler()->alter('updater_info', $updaters);
     uasort($updaters, 'drupal_sort_weight');
   }
   return $updaters;
@@ -4849,7 +4849,7 @@ function drupal_get_filetransfer_info() {
   $info = &drupal_static(__FUNCTION__);
   if (!isset($info)) {
     $info = module_invoke_all('filetransfer_info');
-    drupal_alter('filetransfer_info', $info);
+    Drupal::moduleHandler()->alter('filetransfer_info', $info);
     uasort($info, 'drupal_sort_weight');
   }
   return $info;
diff --git a/core/includes/entity.inc b/core/includes/entity.inc
index 2b3885e..fe625e3 100644
--- a/core/includes/entity.inc
+++ b/core/includes/entity.inc
@@ -72,7 +72,7 @@ function entity_get_bundles($entity_type = NULL) {
           $bundles[$type][$type]['label'] = $entity_info['label'];
         }
       }
-      drupal_alter('entity_bundle_info', $bundles);
+      Drupal::moduleHandler()->alter('entity_bundle_info', $bundles);
       cache()->set("entity_bundle_info:$langcode", $bundles, CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE));
     }
   }
@@ -128,7 +128,7 @@ function entity_get_form_modes($entity_type = NULL) {
         list($form_mode_entity_type, $form_mode_name) = explode('.', $form_mode->id(), 2);
         $form_modes[$form_mode_entity_type][$form_mode_name] = (array) $form_mode;
       }
-      drupal_alter('entity_form_mode_info', $form_modes);
+      Drupal::moduleHandler()->alter('entity_form_mode_info', $form_modes);
       cache()->set("entity_form_mode_info:$langcode", $form_modes, CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE));
     }
   }
@@ -166,7 +166,7 @@ function entity_get_view_modes($entity_type = NULL) {
         list($view_mode_entity_type, $view_mode_name) = explode('.', $view_mode->id(), 2);
         $view_modes[$view_mode_entity_type][$view_mode_name] = (array) $view_mode;
       }
-      drupal_alter('entity_view_mode_info', $view_modes);
+      Drupal::moduleHandler()->alter('entity_view_mode_info', $view_modes);
       cache()->set("entity_view_mode_info:$langcode", $view_modes, CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE));
     }
   }
diff --git a/core/includes/file.inc b/core/includes/file.inc
index 1af50cc..f36dd64 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -197,7 +197,7 @@ function file_get_stream_wrappers($filter = STREAM_WRAPPERS_ALL) {
       // Add defaults.
       $wrappers[$scheme] += array('type' => STREAM_WRAPPERS_NORMAL);
     }
-    drupal_alter('stream_wrappers', $wrappers);
+    Drupal::moduleHandler()->alter('stream_wrappers', $wrappers);
     $existing = stream_get_wrappers();
     foreach ($wrappers as $scheme => $info) {
       // We only register classes that implement our interface.
@@ -433,7 +433,7 @@ function file_stream_wrapper_get_instance_by_scheme($scheme) {
 function file_create_url($uri) {
   // Allow the URI to be altered, e.g. to serve a file from a CDN or static
   // file server.
-  drupal_alter('file_url', $uri);
+  Drupal::moduleHandler()->alter('file_url', $uri);

   $scheme = file_uri_scheme($uri);

diff --git a/core/includes/file.mimetypes.inc b/core/includes/file.mimetypes.inc
index 7468a60..4d8011d 100644
--- a/core/includes/file.mimetypes.inc
+++ b/core/includes/file.mimetypes.inc
@@ -20,7 +20,7 @@ function file_mimetype_mapping() {
   if (!isset($mapping)) {
     $mapping = file_default_mimetype_mapping();
     // Allow modules to alter the default mapping.
-    drupal_alter('file_mimetype_mapping', $mapping);
+    Drupal::moduleHandler()->alter('file_mimetype_mapping', $mapping);
   }
   return $mapping;
 }
diff --git a/core/includes/form.inc b/core/includes/form.inc
index d602d54..0e7544f 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -1160,7 +1160,7 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
     $hooks[] = 'form_' . $form_state['build_info']['base_form_id'];
   }
   $hooks[] = 'form_' . $form_id;
-  drupal_alter($hooks, $form, $form_state, $form_id);
+  Drupal::moduleHandler()->alter($hooks, $form, $form_state, $form_id);
 }


@@ -5124,7 +5124,7 @@ function batch_process($redirect = NULL, $url = 'batch', $redirect_callback = NU
     // The batch is now completely built. Allow other modules to make changes
     // to the batch so that it is easier to reuse batch processes in other
     // environments.
-    drupal_alter('batch', $batch);
+    Drupal::moduleHandler()->alter('batch', $batch);

     // Assign an arbitrary id: don't rely on a serial column in the 'batch'
     // table, since non-progressive batches skip database storage completely.
diff --git a/core/includes/language.inc b/core/includes/language.inc
index e63acaa..fb972cf 100644
--- a/core/includes/language.inc
+++ b/core/includes/language.inc
@@ -163,7 +163,7 @@ function language_types_info() {
   if (!isset($language_types)) {
     $language_types = module_invoke_all('language_types_info');
     // Let other modules alter the list of language types.
-    drupal_alter('language_types_info', $language_types);
+    Drupal::moduleHandler()->alter('language_types_info', $language_types);
   }

   return $language_types;
@@ -328,7 +328,7 @@ function language_negotiation_get_switch_links($type, $path) {

       if (!empty($result)) {
         // Allow modules to provide translations for specific links.
-        drupal_alter('language_switch_links', $result, $type, $path);
+        Drupal::moduleHandler()->alter('language_switch_links', $result, $type, $path);
         $links = (object) array('links' => $result, 'method_id' => $method_id);
         break;
       }
@@ -430,7 +430,7 @@ function language_negotiation_info() {
     );

      // Let other modules alter the list of language negotiation methods.
-     drupal_alter('language_negotiation_info', $negotiation_info);
+     Drupal::moduleHandler()->alter('language_negotiation_info', $negotiation_info);
   }

   return $negotiation_info;
@@ -552,7 +552,7 @@ function language_fallback_get_candidates($type = Language::TYPE_CONTENT) {
     $fallback_candidates[] = Language::LANGCODE_NOT_SPECIFIED;

     // Let other modules hook in and add/change candidates.
-    drupal_alter('language_fallback_candidates', $fallback_candidates);
+    Drupal::moduleHandler()->alter('language_fallback_candidates', $fallback_candidates);
   }

   return $fallback_candidates;
diff --git a/core/includes/mail.inc b/core/includes/mail.inc
index c9ff601..46bce34 100644
--- a/core/includes/mail.inc
+++ b/core/includes/mail.inc
@@ -167,7 +167,7 @@ function drupal_mail($module, $key, $to, $langcode, $params = array(), $from = N
   }

   // Invoke hook_mail_alter() to allow all modules to alter the resulting e-mail.
-  drupal_alter('mail', $message);
+  Drupal::moduleHandler()->alter('mail', $message);

   // Retrieve the responsible implementation for this message.
   $system = drupal_mail_system($module, $key);
diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index c90575e..a7617d9 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -483,7 +483,7 @@ function menu_get_item($path = NULL, $router_item = NULL) {
     if ($router_item) {
       // Allow modules to alter the router item before it is translated and
       // checked for access.
-      drupal_alter('menu_get_item', $router_item, $path, $original_map);
+      Drupal::moduleHandler()->alter('menu_get_item', $router_item, $path, $original_map);

       $map = _menu_translate($router_item, $original_map);
       $router_item['original_map'] = $original_map;
@@ -944,7 +944,7 @@ function _menu_link_translate(&$item, $translate = FALSE) {
   // options array. For performance reasons we only invoke this hook if the link
   // has the 'alter' flag set in the options array.
   if (!empty($item['options']['alter'])) {
-    drupal_alter('translated_menu_link', $item, $map);
+    Drupal::moduleHandler()->alter('translated_menu_link', $item, $map);
   }

   return $map;
@@ -2250,7 +2250,7 @@ function menu_contextual_links($module, $parent_path, $args) {
   }

   // Allow modules to alter contextual links.
-  drupal_alter('menu_contextual_links', $links, $router_item, $root_path);
+  Drupal::moduleHandler()->alter('menu_contextual_links', $links, $router_item, $root_path);

   // Performance: If the current user does not have access to any links for this
   // router path and no other module added further links, we assign FALSE here
@@ -2625,7 +2625,7 @@ function menu_get_active_breadcrumb() {

     // Allow modules to alter the breadcrumb, if possible, as that is much
     // faster than rebuilding an entirely new active trail.
-    drupal_alter('menu_breadcrumb', $active_trail, $item);
+    Drupal::moduleHandler()->alter('menu_breadcrumb', $active_trail, $item);

     // Don't show a link to the current page in the breadcrumb trail.
     $end = end($active_trail);
@@ -2763,7 +2763,7 @@ function menu_router_build($save = FALSE) {
     }
   }
   // Alter the menu as defined in modules, keys are like user/%user.
-  drupal_alter('menu', $callbacks);
+  Drupal::moduleHandler()->alter('menu', $callbacks);
   foreach ($callbacks as $path => $router_item) {
     // If the menu item is a default local task and incorrectly references a
     // route, remove it.
diff --git a/core/includes/path.inc b/core/includes/path.inc
index 911cfe0..1a7d1d5 100644
--- a/core/includes/path.inc
+++ b/core/includes/path.inc
@@ -159,7 +159,7 @@ function path_get_admin_paths() {
   $patterns = &drupal_static(__FUNCTION__);
   if (!isset($patterns)) {
     $paths = module_invoke_all('admin_paths');
-    drupal_alter('admin_paths', $paths);
+    Drupal::moduleHandler()->alter('admin_paths', $paths);
     // Combine all admin paths into one array, and likewise for non-admin paths,
     // for easier handling.
     $patterns = array();
diff --git a/core/includes/schema.inc b/core/includes/schema.inc
index 77faade..a0b99ac 100644
--- a/core/includes/schema.inc
+++ b/core/includes/schema.inc
@@ -91,7 +91,7 @@ function drupal_get_complete_schema($rebuild = FALSE) {
         _drupal_schema_initialize($current, $module);
         $schema = array_merge($schema, $current);
       }
-      drupal_alter('schema', $schema);
+      Drupal::moduleHandler()->alter('schema', $schema);

       if ($rebuild) {
         cache()->deleteTags(array('schema' => TRUE));
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 7bff76e..c91d32c 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -650,7 +650,7 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) {
   _theme_process_registry($cache, $theme->name, 'theme', $theme->name, dirname($theme->filename));

   // Let modules alter the registry.
-  drupal_alter('theme_registry', $cache);
+  Drupal::moduleHandler()->alter('theme_registry', $cache);

   // Optimize the registry to not have empty arrays for functions.
   foreach ($cache as $hook => $info) {
@@ -2551,7 +2551,7 @@ function _template_preprocess_default_variables() {
   }

   // Give modules a chance to alter the default template variables.
-  drupal_alter('template_preprocess_default_variables', $variables);
+  Drupal::moduleHandler()->alter('template_preprocess_default_variables', $variables);

   return $variables;
 }
diff --git a/core/lib/Drupal/Core/Ajax/AjaxResponse.php b/core/lib/Drupal/Core/Ajax/AjaxResponse.php
index 2a72267..bde78d7 100644
--- a/core/lib/Drupal/Core/Ajax/AjaxResponse.php
+++ b/core/lib/Drupal/Core/Ajax/AjaxResponse.php
@@ -86,7 +86,7 @@ protected function ajaxRender(Request $request) {
       else {
         $function = 'drupal_add_' . $type;
         $items[$type] = $function();
-        drupal_alter($type, $items[$type]);
+        Drupal::moduleHandler()->alter($type, $items[$type]);
         // @todo Inline CSS and JS items are indexed numerically. These can't be
         //   reliably diffed with array_diff_key(), since the number can change
         //   due to factors unrelated to the inline content, so for now, we
@@ -137,7 +137,7 @@ protected function ajaxRender(Request $request) {
     }

     $commands = $this->commands;
-    drupal_alter('ajax_render', $commands);
+    Drupal::moduleHandler()->alter('ajax_render', $commands);

     return $commands;
   }
diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php
index e5eeaf2..f4121b9 100644
--- a/core/lib/Drupal/Core/Database/Query/Select.php
+++ b/core/lib/Drupal/Core/Database/Query/Select.php
@@ -391,7 +391,7 @@ public function preExecute(SelectInterface $query = NULL) {
       foreach ($this->alterTags as $tag => $value) {
         $hooks[] = 'query_' . $tag;
       }
-      drupal_alter($hooks, $query);
+      Drupal::moduleHandler()->alter($hooks, $query);
     }

     $this->prepared = TRUE;
diff --git a/core/lib/Drupal/Core/Entity/EntityRenderController.php b/core/lib/Drupal/Core/Entity/EntityRenderController.php
index cd92f52..ab786bd 100644
--- a/core/lib/Drupal/Core/Entity/EntityRenderController.php
+++ b/core/lib/Drupal/Core/Entity/EntityRenderController.php
@@ -108,7 +108,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la

       // Allow modules to change the view mode.
       $entity_view_mode = $view_mode;
-      drupal_alter('entity_view_mode', $entity_view_mode, $entity, $context);
+      Drupal::moduleHandler()->alter('entity_view_mode', $entity_view_mode, $entity, $context);
       // Store entities for rendering by view_mode.
       $view_modes[$entity_view_mode][$entity->id()] = $entity;

@@ -123,7 +123,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
           'bundle' => $bundle,
           'view_mode' => $entity_view_mode,
         );
-        drupal_alter('entity_display', $display, $display_context);
+        Drupal::moduleHandler()->alter('entity_display', $display, $display_context);

         $displays[$entity_view_mode][$bundle] = $display;
       }
@@ -159,7 +159,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
       $build[$key]['#weight'] = $weight++;

       // Allow modules to modify the render array.
-      drupal_alter(array($view_hook, 'entity_view'), $build[$key], $entity, $display);
+      Drupal::moduleHandler()->alter(array($view_hook, 'entity_view'), $build[$key], $entity, $display);
     }

     return $build;
diff --git a/core/lib/Drupal/Core/Entity/Field/Field.php b/core/lib/Drupal/Core/Entity/Field/Field.php
index 0ff36d7..3021a06 100644
--- a/core/lib/Drupal/Core/Entity/Field/Field.php
+++ b/core/lib/Drupal/Core/Entity/Field/Field.php
@@ -190,7 +190,7 @@ public function access($operation = 'view', AccountInterface $account = NULL) {
       'field' => $this,
       'account' => $account,
     );
-    drupal_alter('entity_field_access', $grants, $context);
+    Drupal::moduleHandler()->alter('entity_field_access', $grants, $context);

     // One grant being FALSE is enough to deny access immediately.
     if (in_array(FALSE, $grants, TRUE)) {
diff --git a/core/lib/Drupal/Core/Plugin/Discovery/AlterDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/AlterDecorator.php
index 8bcee3f..5593e30 100644
--- a/core/lib/Drupal/Core/Plugin/Discovery/AlterDecorator.php
+++ b/core/lib/Drupal/Core/Plugin/Discovery/AlterDecorator.php
@@ -56,7 +56,7 @@ public function getDefinition($plugin_id) {
    */
   public function getDefinitions() {
     $definitions = $this->decorated->getDefinitions();
-    drupal_alter($this->hook, $definitions);
+    Drupal::moduleHandler()->alter($this->hook, $definitions);
     return $definitions;
   }

diff --git a/core/lib/Drupal/Core/Session/UserSession.php b/core/lib/Drupal/Core/Session/UserSession.php
index 7922d06..a6ef811 100644
--- a/core/lib/Drupal/Core/Session/UserSession.php
+++ b/core/lib/Drupal/Core/Session/UserSession.php
@@ -198,7 +198,7 @@ function getPreferredAdminLangcode($default = NULL) {
    */
   public function getUsername() {
     $name = $this->name ?: \Drupal::config('user.settings')->get('anonymous');
-    \Drupal::moduleHandler()->alter('user_format_name', $name, $this);
+    Drupal::moduleHandler()->alter('user_format_name', $name, $this);
     return $name;
   }

diff --git a/core/lib/Drupal/Core/Transliteration/PHPTransliteration.php b/core/lib/Drupal/Core/Transliteration/PHPTransliteration.php
index 6af4708..99bce58 100644
--- a/core/lib/Drupal/Core/Transliteration/PHPTransliteration.php
+++ b/core/lib/Drupal/Core/Transliteration/PHPTransliteration.php
@@ -27,7 +27,7 @@ protected function readLanguageOverrides($langcode) {
     parent::readLanguageOverrides($langcode);

     // Let modules alter the language-specific overrides.
-    drupal_alter('transliteration_overrides', $this->languageOverrides[$langcode], $langcode);
+    Drupal::moduleHandler()->alter('transliteration_overrides', $this->languageOverrides[$langcode], $langcode);
   }

 }
diff --git a/core/modules/block/lib/Drupal/block/BlockRenderController.php b/core/modules/block/lib/Drupal/block/BlockRenderController.php
index 45a85d9..8bce40d 100644
--- a/core/modules/block/lib/Drupal/block/BlockRenderController.php
+++ b/core/modules/block/lib/Drupal/block/BlockRenderController.php
@@ -54,7 +54,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
       }

       list($base_id) = explode(':', $plugin_id);
-      drupal_alter(array('block_view', "block_view_$base_id"), $build[$entity_id], $plugin);
+      Drupal::moduleHandler()->alter(array('block_view', "block_view_$base_id"), $build[$entity_id], $plugin);

       // @todo Remove after fixing http://drupal.org/node/1989568.
       $build[$entity_id]['#block'] = $entity;
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
index 5b79bf2..314ae42 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
@@ -297,7 +297,7 @@ public function buildContentsCssJSSetting(EditorEntity $editor) {
       drupal_get_path('module', 'system') . '/css/system.module.css',
     );
     $css = array_merge($css, _ckeditor_theme_css());
-    drupal_alter('ckeditor_css', $css, $editor);
+    Drupal::moduleHandler()->alter('ckeditor_css', $css, $editor);
     $css = array_map('file_create_url', $css);

     return array_values($css);
diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module
index 03cd17e..560f42b 100644
--- a/core/modules/contextual/contextual.module
+++ b/core/modules/contextual/contextual.module
@@ -272,7 +272,7 @@ function contextual_pre_render_links($element) {
   $element['#links'] = $links;

   // Allow modules to alter the renderable contextual links element.
-  drupal_alter('contextual_links_view', $element, $items);
+  Drupal::moduleHandler()->alter('contextual_links_view', $element, $items);

   // If there are no links, tell drupal_render() to abort rendering.
   if (empty($element['#links'])) {
diff --git a/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php b/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php
index e14e0d2..ccd78cc 100644
--- a/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php
+++ b/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php
@@ -80,7 +80,7 @@ protected function init(array &$form_state, EntityInterface $entity, $field_name
       'bundle' => $entity->bundle(),
       'form_mode' => 'default',
     );
-    \Drupal::moduleHandler()->alter('entity_form_display', $form_display, $form_display_context);
+    Drupal::moduleHandler()->alter('entity_form_display', $form_display, $form_display_context);

     $form_state['form_display'] = $form_display;
   }
diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php
index 710b991..a6dc027 100644
--- a/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php
+++ b/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php
@@ -80,7 +80,7 @@ public function __construct(array $values, $entity_type) {
     // Initialize settings, merging module-provided defaults.
     $default_settings = $plugin->getDefaultSettings();
     $default_settings += module_invoke_all('editor_default_settings', $this->editor);
-    drupal_alter('editor_default_settings', $default_settings, $this->editor);
+    Drupal::moduleHandler()->alter('editor_default_settings', $default_settings, $this->editor);
     $this->settings += $default_settings;
   }

diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
index 2d05b1a..3785051 100644
--- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
+++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
@@ -83,7 +83,7 @@ public function getAttachments(array $format_ids) {
     }

     // We have all JavaScript settings, allow other modules to alter them.
-    drupal_alter('editor_js_settings', $settings);
+    Drupal::moduleHandler()->alter('editor_js_settings', $settings);

     if (empty($attachments['library']) && empty($settings)) {
       return array();
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
index de4729c..dc94f9e 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
@@ -309,7 +309,7 @@ protected function reAlterQuery(AlterableInterface $query, $tag, $base_table) {

     $query->alterTags = array($tag => TRUE);
     $query->alterMetaData['base_table'] = $base_table;
-    drupal_alter(array('query', 'query_' . $tag), $query);
+    Drupal::moduleHandler()->alter(array('query', 'query_' . $tag), $query);

     // Restore the tags and metadata.
     $query->alterTags = $old_tags;
diff --git a/core/modules/field/field.attach.inc b/core/modules/field/field.attach.inc
index 5ed17ff..c1d5674 100644
--- a/core/modules/field/field.attach.inc
+++ b/core/modules/field/field.attach.inc
@@ -1108,7 +1108,7 @@ function field_attach_view(EntityInterface $entity, EntityDisplay $display, $lan
     'display_options' => $view_mode,
     'langcode' => $langcode,
   );
-  drupal_alter('field_attach_view', $output, $context);
+  Drupal::moduleHandler()->alter('field_attach_view', $output, $context);

   // Reset the _field_view_prepared flag set in field_attach_prepare_view(),
   // in case the same entity is displayed with different settings later in
@@ -1150,7 +1150,7 @@ function field_attach_preprocess(EntityInterface $entity, $element, &$variables)
     'entity' => $entity,
     'element' => $element,
   );
-  drupal_alter('field_attach_preprocess', $variables, $context);
+  Drupal::moduleHandler()->alter('field_attach_preprocess', $variables, $context);
 }

 /**
diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc
index b6b2a95..69caec0 100644
--- a/core/modules/field/field.info.inc
+++ b/core/modules/field/field.info.inc
@@ -94,7 +94,7 @@ function _field_info_collate_types() {
           $info['storage types'][$name]['module'] = $module;
         }
       }
-      drupal_alter('field_storage_info', $info['storage types']);
+      Drupal::moduleHandler()->alter('field_storage_info', $info['storage types']);

       cache('field')->set("field_info_types:$langcode", $info, CacheBackendInterface::CACHE_PERMANENT, array('field_info_types' => TRUE));
     }
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 92a2c45..94a25a2 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -826,7 +826,7 @@ function field_view_field(EntityInterface $entity, $field_name, $display_options
       'display_options' => $display_options,
       'langcode' => $display_langcode,
     );
-    drupal_alter('field_attach_view', $result, $context);
+    Drupal::moduleHandler()->alter('field_attach_view', $result, $context);

     if (isset($result[$field_name])) {
       $output = $result[$field_name];
diff --git a/core/modules/field/field.multilingual.inc b/core/modules/field/field.multilingual.inc
index ca33a31..92b7e03 100644
--- a/core/modules/field/field.multilingual.inc
+++ b/core/modules/field/field.multilingual.inc
@@ -96,7 +96,7 @@ function field_available_languages($entity_type, $field) {
       $langcodes = field_content_languages();
       // Let other modules alter the available languages.
       $context = array('entity_type' => $entity_type, 'field' => $field);
-      drupal_alter('field_available_languages', $langcodes, $context);
+      Drupal::moduleHandler()->alter('field_available_languages', $langcodes, $context);
       $field_langcodes[$entity_type][$field_name] = $langcodes;
     }
     else {
@@ -293,7 +293,7 @@ function field_language(EntityInterface $entity, $field_name = NULL, $langcode =
       if (field_language_fallback_enabled() && field_has_translation_handler($entity_type)) {
         field_language_fallback($display_langcode, $context['entity'], $context['langcode']);
       }
-      drupal_alter('field_language', $display_langcode, $context);
+      Drupal::moduleHandler()->alter('field_language', $display_langcode, $context);
     }

     $display_langcodes[$entity_type][$id][$langcode] = $display_langcode;
diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php
index e7e46b9..4fb4d6a 100644
--- a/core/modules/field/lib/Drupal/field/FieldInfo.php
+++ b/core/modules/field/lib/Drupal/field/FieldInfo.php
@@ -529,7 +529,7 @@ public function getBundleExtraFields($entity_type, $bundle) {
     // all bundles.
     $info = array();
     $extra = $this->moduleHandler->invokeAll('field_extra_fields');
-    drupal_alter('field_extra_fields', $extra);
+    Drupal::moduleHandler()->alter('field_extra_fields', $extra);
     // Merge in saved settings.
     if (isset($extra[$entity_type][$bundle])) {
       $info = $this->prepareExtraFields($extra[$entity_type][$bundle], $entity_type, $bundle);
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php
index 654cbbe..5a81cf6 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php
@@ -271,7 +271,7 @@ protected function formSingleElement(EntityInterface $entity, array $items, $del
         'delta' => $delta,
         'default' => !empty($entity->field_ui_default_value),
       );
-      drupal_alter(array('field_widget_form', 'field_widget_' . $this->getPluginId() . '_form'), $element, $form_state, $context);
+      Drupal::moduleHandler()->alter(array('field_widget_form', 'field_widget_' . $this->getPluginId() . '_form'), $element, $form_state, $context);
     }

     return $element;
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
index 841c056..6f0a832 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
@@ -197,7 +197,7 @@ protected function alterSettingsForm(array &$settings_form, $plugin, FieldInstan
       'view_mode' => $this->mode,
       'form' => $form,
     );
-    drupal_alter('field_formatter_settings_form', $settings_form, $form_state, $context);
+    Drupal::moduleHandler()->alter('field_formatter_settings_form', $settings_form, $form_state, $context);
   }

   /**
@@ -210,7 +210,7 @@ protected function alterSettingsSummary(array &$summary, $plugin, FieldInstanceI
       'instance' => $instance,
       'view_mode' => $this->mode,
     );
-    drupal_alter('field_formatter_settings_summary', $summary, $context);
+    Drupal::moduleHandler()->alter('field_formatter_settings_summary', $summary, $context);
   }

 }
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php
index d2ab86a..91e72c8 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php
@@ -142,7 +142,7 @@ protected function alterSettingsForm(array &$settings_form, $plugin, FieldInstan
       'form_mode' => $this->mode,
       'form' => $form,
     );
-    drupal_alter('field_widget_settings_form', $settings_form, $form_state, $context);
+    Drupal::moduleHandler()->alter('field_widget_settings_form', $settings_form, $form_state, $context);
   }

   /**
@@ -155,7 +155,7 @@ protected function alterSettingsSummary(array &$summary, $plugin, FieldInstanceI
       'instance' => $instance,
       'form_mode' => $this->mode,
     );
-    drupal_alter('field_widget_settings_summary', $summary, $context);
+    Drupal::moduleHandler()->alter('field_widget_settings_summary', $summary, $context);
   }

 }
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 0d66adb..e7efbc5 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -669,7 +669,7 @@ function file_file_download($uri, $field_type = 'file') {
           'field' => $field,
           'file' => $file,
         );
-        drupal_alter('file_download_access', $grants, $context);
+        Drupal::moduleHandler()->alter('file_download_access', $grants, $context);

         if (in_array(TRUE, $grants)) {
           // If TRUE is returned, access is granted and no further checks are
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 4e786bd..03f261e 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -452,7 +452,7 @@ function image_effect_definitions() {
         }
       }
       uasort($effects, '_image_effect_definitions_sort');
-      drupal_alter('image_effect_info', $effects);
+      Drupal::moduleHandler()->alter('image_effect_info', $effects);
       cache()->set("image_effects:$langcode", $effects);
     }
   }
diff --git a/core/modules/locale/locale.compare.inc b/core/modules/locale/locale.compare.inc
index d0271bd..44a8ece 100644
--- a/core/modules/locale/locale.compare.inc
+++ b/core/modules/locale/locale.compare.inc
@@ -148,7 +148,7 @@ function locale_translation_project_list() {
     }

     // Allow other modules to alter projects before fetching and comparing.
-    drupal_alter('locale_translation_projects', $projects);
+    Drupal::moduleHandler()->alter('locale_translation_projects', $projects);
   }
   return $projects;
 }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php
index e2b4c07..d8a78c6 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php
@@ -79,7 +79,7 @@ function testNodeAccessRecords() {
     foreach ($operations as $op) {
       $grants = node_test_node_grants($op, $web_user);
       $altered_grants = $grants;
-      drupal_alter('node_grants', $altered_grants, $web_user, $op);
+      Drupal::moduleHandler()->alter('node_grants', $altered_grants, $web_user, $op);
       $this->assertNotEqual($grants, $altered_grants, format_string('Altered the %op grant for a user.', array('%op' => $op)));
     }

diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 45f19c7..62f8e29 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -2187,7 +2187,7 @@ function node_access_grants($op, $account = NULL) {
   // Fetch node access grants from other modules.
   $grants = module_invoke_all('node_grants', $account, $op);
   // Allow modules to alter the assigned grants.
-  drupal_alter('node_grants', $grants, $account, $op);
+  Drupal::moduleHandler()->alter('node_grants', $grants, $account, $op);

   return array_merge(array('all' => array(0)), $grants);
 }
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 587b6c0..1546e51 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -502,7 +502,7 @@ function simpletest_test_get_all() {
       }

       // Allow modules extending core tests to disable originals.
-      drupal_alter('simpletest', $groups);
+      Drupal::moduleHandler()->alter('simpletest', $groups);
       cache()->set('simpletest', $groups);
     }
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/AlterTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/AlterTest.php
index c2f1595..a5a44bd 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/AlterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/AlterTest.php
@@ -47,13 +47,13 @@ function testDrupalAlter() {
     // Verify alteration of a single argument.
     $array_copy = $array;
     $array_expected = array('foo' => 'Drupal theme');
-    drupal_alter('drupal_alter', $array_copy);
+    Drupal::moduleHandler()->alter('drupal_alter', $array_copy);
     $this->assertEqual($array_copy, $array_expected, 'Single array was altered.');

     $entity_copy = clone $entity;
     $entity_expected = clone $entity;
     $entity_expected->foo = 'Drupal theme';
-    drupal_alter('drupal_alter', $entity_copy);
+    Drupal::moduleHandler()->alter('drupal_alter', $entity_copy);
     $this->assertEqual($entity_copy, $entity_expected, 'Single object was altered.');

     // Verify alteration of multiple arguments.
@@ -64,7 +64,7 @@ function testDrupalAlter() {
     $entity_expected->foo = 'Drupal theme';
     $array2_copy = $array;
     $array2_expected = array('foo' => 'Drupal theme');
-    drupal_alter('drupal_alter', $array_copy, $entity_copy, $array2_copy);
+    Drupal::moduleHandler()->alter('drupal_alter', $array_copy, $entity_copy, $array2_copy);
     $this->assertEqual($array_copy, $array_expected, 'First argument to drupal_alter() was altered.');
     $this->assertEqual($entity_copy, $entity_expected, 'Second argument to drupal_alter() was altered.');
     $this->assertEqual($array2_copy, $array2_expected, 'Third argument to drupal_alter() was altered.');
@@ -74,7 +74,7 @@ function testDrupalAlter() {
     // other modules.
     $array_copy = $array;
     $array_expected = array('foo' => 'Drupal block theme');
-    drupal_alter(array('drupal_alter', 'drupal_alter_foo'), $array_copy);
+    Drupal::moduleHandler()->alter(array('drupal_alter', 'drupal_alter_foo'), $array_copy);
     $this->assertEqual($array_copy, $array_expected, 'hook_TYPE_alter() implementations ran in correct order.');
   }
 }
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index aa36ba7..c507c28 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -210,7 +210,7 @@ function system_themes_page() {
   }

   uasort($theme_groups['enabled'], 'system_sort_themes');
-  drupal_alter('system_themes_page', $theme_groups);
+  Drupal::moduleHandler()->alter('system_themes_page', $theme_groups);

   $admin_form = drupal_get_form('system_themes_admin_form', $admin_theme_options);
   return theme('system_themes_page', array('theme_groups' => $theme_groups, 'theme_group_titles' => $theme_group_titles)) . drupal_render($admin_form);
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index e771d4e..175260d 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2661,7 +2661,7 @@ function _system_rebuild_module_data() {
     // Invoke hook_system_info_alter() to give installed modules a chance to
     // modify the data in the .info.yml files if necessary.
     $type = 'module';
-    drupal_alter('system_info', $modules[$key]->info, $modules[$key], $type);
+    Drupal::moduleHandler()->alter('system_info', $modules[$key]->info, $modules[$key], $type);
   }

   if (isset($modules[$profile])) {
@@ -2795,7 +2795,7 @@ function _system_rebuild_theme_data() {
     // Invoke hook_system_info_alter() to give installed modules a chance to
     // modify the data in the .info.yml files if necessary.
     $type = 'theme';
-    drupal_alter('system_info', $themes[$key]->info, $themes[$key], $type);
+    Drupal::moduleHandler()->alter('system_info', $themes[$key]->info, $themes[$key], $type);

     if (!empty($themes[$key]->info['base theme'])) {
       $sub_themes[] = $key;
diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module
index 51cb6d3..5498fdd 100644
--- a/core/modules/system/tests/modules/theme_test/theme_test.module
+++ b/core/modules/system/tests/modules/theme_test/theme_test.module
@@ -138,7 +138,7 @@ function _theme_custom_theme() {
  */
 function _theme_test_alter() {
   $data = 'foo';
-  drupal_alter('theme_test_alter', $data);
+  Drupal::moduleHandler()->alter('theme_test_alter', $data);
   return "The altered data is $data.";
 }

diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index bae1b07..debe56a 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -203,7 +203,7 @@ function ($object) {
   // Get toolbar items from all modules that implement hook_toolbar().
   $items = module_invoke_all('toolbar');
   // Allow for altering of hook_toolbar().
-  drupal_alter('toolbar', $items);
+  Drupal::moduleHandler()->alter('toolbar', $items);
   // Sort the children.
   uasort($items, 'element_sort');

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 4b8ac15..66b4b9a 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
@@ -114,7 +114,7 @@ public function getTips() {
       return ($a->getWeight() < $b->getWeight()) ? -1 : 1;
     });

-    \Drupal::moduleHandler()->alter('tour_tips', $tips, $this);
+    Drupal::moduleHandler()->alter('tour_tips', $tips, $this);
     return array_values($tips);
   }

diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc
index 6741b41..3a0987a 100644
--- a/core/modules/update/update.compare.inc
+++ b/core/modules/update/update.compare.inc
@@ -71,7 +71,7 @@ function update_get_projects() {
         $project_info->processInfoList($projects, $theme_data, 'theme', FALSE);
       }
       // Allow other modules to alter projects before fetching and comparing.
-      drupal_alter('update_projects', $projects);
+      Drupal::moduleHandler()->alter('update_projects', $projects);
       // Store the site's project data for at most 1 hour.
       Drupal::keyValueExpirable('update')->setWithExpire('update_project_projects', $projects, 3600);
     }
@@ -175,7 +175,7 @@ function update_calculate_project_data($available) {
   // Give other modules a chance to alter the status (for example, to allow a
   // contrib module to provide fine-grained settings to ignore specific
   // projects or releases).
-  drupal_alter('update_status', $projects);
+  Drupal::moduleHandler()->alter('update_status', $projects);

   // Store the site's update status for at most 1 hour.
   Drupal::keyValueExpirable('update')->setWithExpire('update_project_data', $projects, 3600);
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
index b229ff1..b07d9ff 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
@@ -409,7 +409,7 @@ public function isAnonymous() {
    */
   public function getUsername() {
     $name = $this->get('name')->value ?: \Drupal::config('user.settings')->get('anonymous');
-    \Drupal::moduleHandler()->alter('user_format_name', $name, $this);
+    Drupal::moduleHandler()->alter('user_format_name', $name, $this);
     return $name;
   }

diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc
index 6077a27..46ab9f4 100644
--- a/core/modules/user/user.pages.inc
+++ b/core/modules/user/user.pages.inc
@@ -268,7 +268,7 @@ function user_cancel_methods() {
     ),
   );
   // Allow modules to customize account cancellation methods.
-  drupal_alter('user_cancel_methods', $methods);
+  Drupal::moduleHandler()->alter('user_cancel_methods', $methods);

   // Turn all methods into real form elements.
   $default_method = config('user.settings')->get('cancel_method');
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
index 5569977..2f02c2e 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php
@@ -311,7 +311,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     );
     // Allow to alter the default values brought into the form.
     // @todo Do we really want to keep this hook.
-    \Drupal::moduleHandler()->alter('views_handler_options', $this->options, $this->view);
+    Drupal::moduleHandler()->alter('views_handler_options', $this->options, $this->view);
   }

   /**
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
index 015a855..6d97fbe 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
@@ -348,7 +348,7 @@ public function getDisplayTab($view) {
     }
     // In AJAX context, ViewUI::rebuildCurrentTab() returns this outside of form
     // context, so hook_form_views_ui_edit_form_alter() is insufficient.
-    \Drupal::moduleHandler()->alter('views_ui_display_tab', $build, $view, $display_id);
+    Drupal::moduleHandler()->alter('views_ui_display_tab', $build, $view, $display_id);
     return $build;
   }

@@ -691,7 +691,7 @@ public function renderDisplayTop(ViewUI $view) {
     );

     // Let other modules add additional links here.
-    \Drupal::moduleHandler()->alter('views_ui_display_top_links', $element['extra_actions']['#links'], $view, $display_id);
+    Drupal::moduleHandler()->alter('views_ui_display_top_links', $element['extra_actions']['#links'], $view, $display_id);

     if (isset($view->type) && $view->type != t('Default')) {
       if ($view->type == t('Overridden')) {
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
index e3538e6..08f21e1 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -659,7 +659,7 @@ public function renderPreview($display_id, $args = array()) {
             $rows['statistics'][] = array('<strong>' . t('View render time') . '</strong>', t('@time ms', array('@time' => intval($this->executable->render_time * 100000) / 100)));

           }
-          \Drupal::moduleHandler()->alter('views_preview_info', $rows, $this);
+          Drupal::moduleHandler()->alter('views_preview_info', $rows, $this);
         }
         else {
           // No query was run. Display that information in place of either the
diff --git a/core/modules/xmlrpc/xmlrpc.server.inc b/core/modules/xmlrpc/xmlrpc.server.inc
index fded011..534608b 100644
--- a/core/modules/xmlrpc/xmlrpc.server.inc
+++ b/core/modules/xmlrpc/xmlrpc.server.inc
@@ -62,7 +62,7 @@ function xmlrpc_server($callbacks) {
   // with those defined by modules implementing the _xmlrpc hook.
   // Built-in methods are overridable.
   $callbacks = array_merge($defaults, (array) $callbacks);
-  drupal_alter('xmlrpc', $callbacks);
+  Drupal::moduleHandler()->alter('xmlrpc', $callbacks);
   foreach ($callbacks as $key => $callback) {
     // we could check for is_array($callback)
     if (is_int($key)) {
--
1.7.9

