22a23,60 > diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc > index 6d70110..df1d674 100644 > --- a/core/includes/bootstrap.inc > +++ b/core/includes/bootstrap.inc > @@ -2155,13 +2155,13 @@ function module_implements($hook) { > /** > * Invokes a hook in a particular module. > * > - * All arguments are passed by value. Use drupal_alter() if you need to pass > - * arguments by reference. > + * All arguments are passed by value. Use \Drupal::moduleHandler->alter() if > + * you need to pass arguments by reference. > * > * @deprecated as of Drupal 8.0. Use > * \Drupal::moduleHandler()->invoke($module, $hook, $args = array()). > * > - * @see drupal_alter() > + * @see \Drupal::moduleHandler->alter() > * @see \Drupal\Core\Extension\ModuleHandler::invoke() > */ > function module_invoke($module, $hook) { > @@ -2174,13 +2174,13 @@ function module_invoke($module, $hook) { > /** > * Invokes a hook in all enabled modules that implement it. > * > - * All arguments are passed by value. Use drupal_alter() if you need to pass > - * arguments by reference. > + * All arguments are passed by value. Use \Drupal::moduleHandler->alter() if > + * you need to pass arguments by reference. > * > * @deprecated as of Drupal 8.0. Use > * \Drupal::moduleHandler()->invokeAll($hook). > * > - * @see drupal_alter() > + * @see \Drupal::moduleHandler->alter() > * @see \Drupal\Core\Extension\ModuleHandler::invokeAll() > */ > function module_invoke_all($hook) { 24c62 < index e70816b..73710dc 100644 --- > index e70816b..f5001d0 100644 35a74,86 > @@ -1606,9 +1606,9 @@ function drupal_add_css($data = NULL, $options = NULL) { > * (optional) An array of CSS files. If no array is provided, the default > * stylesheets array is used instead. > * @param $skip_alter > - * (optional) If set to TRUE, this function skips calling drupal_alter() on > - * $css, useful when the calling function passes a $css array that has already > - * been altered. > + * (optional) If set to TRUE, this function skips calling > + * \Drupal::moduleHandler->alter() on $css, useful when the calling function > + * passes a $css array that has already been altered. > * > * @return > * A string of XHTML CSS tags. 44a96,108 > @@ -2229,9 +2229,9 @@ function drupal_js_defaults($data = NULL) { > * (optional) An array with all JavaScript code. Defaults to the default > * JavaScript array for the given scope. > * @param bool $skip_alter > - * (optional) If set to TRUE, this function skips calling drupal_alter() on > - * $javascript, useful when the calling function passes a $javascript array > - * that has already been altered. > + * (optional) If set to TRUE, this function skips calling > + * \Drupal::moduleHandler->alter() on $javascript, useful when the calling > + * function passes a $javascript array that has already been altered. > * @param bool $is_ajax > * (optional) If set to TRUE, this function is called from an Ajax request and > * adds javascript settings to update ajaxPageState values. 109c173 < index 4dddce1..f3a1551 100644 --- > index 4dddce1..b27e196 100644 129a194,211 > @@ -714,7 +714,7 @@ function entity_get_render_display(EntityInterface $entity, $view_mode) { > 'bundle' => $bundle, > 'view_mode' => $view_mode, > ); > - drupal_alter('entity_display', $display, $display_context); > + \Drupal::moduleHandler()->alter('entity_display', $display, $display_context); > > return $display; > } > @@ -822,7 +822,7 @@ function entity_get_render_form_display(EntityInterface $entity, $form_mode) { > 'bundle' => $bundle, > 'form_mode' => $form_mode, > ); > - drupal_alter('entity_form_display', $form_display, $form_display_context); > + \Drupal::moduleHandler()->alter('entity_form_display', $form_display, $form_display_context); > > return $form_display; > } 291a374,391 > diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc > index 96dcd2f..831aff1 100644 > --- a/core/includes/theme.maintenance.inc > +++ b/core/includes/theme.maintenance.inc > @@ -75,9 +75,10 @@ function _drupal_maintenance_theme() { > > $themes = list_themes(); > > - // list_themes() triggers a drupal_alter() in maintenance mode, but we can't > - // let themes alter the .info.yml data until we know a theme's base themes. So > - // don't set global $theme until after list_themes() builds its cache. > + // list_themes() triggers a \Drupal::moduleHandler->alter() in maintenance > + // mode, but we can't let themes alter the .info.yml data until we know a > + // theme's base themes. So don't set global $theme until after list_themes() > + // builds its cache. > $theme = $custom_theme; > > // Store the identifier for retrieving theme settings with. 326a427,461 > diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php > index c2db6b0..dae3a3b 100644 > --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php > +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php > @@ -203,7 +203,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; > > @@ -243,7 +243,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/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php > index 075e142..f9ef5ce 100644 > --- a/core/lib/Drupal/Core/Field/WidgetBase.php > +++ b/core/lib/Drupal/Core/Field/WidgetBase.php > @@ -260,7 +260,7 @@ protected function formSingleElement(FieldItemListInterface $items, $delta, arra > '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; 339a475,487 > diff --git a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php > index 5aed185..38d6cb6 100644 > --- a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php > +++ b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php > @@ -57,7 +57,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la > $build[$entity_id] = array(); > } > > - 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; 365a514,526 > diff --git a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php > index 27346c9..0cdf734 100644 > --- a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php > +++ b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php > @@ -76,7 +76,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; > } > 404a566,578 > diff --git a/core/modules/field/field.deprecated.inc b/core/modules/field/field.deprecated.inc > index 94373bc..c8c8d51 100644 > --- a/core/modules/field/field.deprecated.inc > +++ b/core/modules/field/field.deprecated.inc > @@ -746,7 +746,7 @@ function field_attach_view(EntityInterface $entity, EntityViewDisplayInterface $ > '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 430a605,619 > diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc > index 7def00e..0a0db23 100644 > --- a/core/modules/field/field.views.inc > +++ b/core/modules/field/field.views.inc > @@ -42,8 +42,8 @@ function field_views_data() { > * > * Field modules can implement hook_field_views_data_views_data_alter() to > * alter the views data on a per field basis. This is weirdly named so as > - * not to conflict with the drupal_alter('field_views_data') in > - * field_views_data. > + * not to conflict with the \Drupal::moduleHandler()->alter('field_views_data') > + * in field_views_data. > */ > function field_views_data_alter(&$data) { > foreach (field_info_fields() as $field) { 554c743 < index 3f6b30c..a25ffa2 100644 --- > index 3f6b30c..e02c590 100644 556a746,763 > @@ -10,7 +10,7 @@ > use Drupal\simpletest\WebTestBase; > > /** > - * Tests alteration of arguments passed to drupal_alter(). > + * Tests alteration of arguments passed to \Drupal::moduleHandler->alter(). > */ > class AlterTest extends WebTestBase { > > @@ -24,7 +24,7 @@ class AlterTest extends WebTestBase { > public static function getInfo() { > return array( > 'name' => 'Alter hook functionality', > - 'description' => 'Tests alteration of arguments passed to drupal_alter().', > + 'description' => 'Tests alteration of arguments passed to \Drupal::moduleHandler->alter().', > 'group' => 'Common', > ); > } 573c780 < @@ -63,7 +63,7 @@ function testDrupalAlter() { --- > @@ -63,17 +63,17 @@ function testDrupalAlter() { 577a785,787 > - $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.'); 579,582c789,795 < $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.'); < @@ -73,7 +73,7 @@ function testDrupalAlter() { --- > + $this->assertEqual($array_copy, $array_expected, 'First argument to \Drupal::moduleHandler->alter() was altered.'); > + $this->assertEqual($entity_copy, $entity_expected, 'Second argument to \Drupal::moduleHandler->alter() was altered.'); > + $this->assertEqual($array2_copy, $array2_expected, 'Third argument to \Drupal::moduleHandler->alter() was altered.'); > > - // Verify alteration order when passing an array of types to drupal_alter(). > + // Verify alteration order when passing an array of types to \Drupal::moduleHandler->alter(). > // common_test_module_implements_alter() places 'block' implementation after 603a817,841 > diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php > index cabea75..e926d4b 100644 > --- a/core/modules/system/system.api.php > +++ b/core/modules/system/system.api.php > @@ -1072,13 +1072,13 @@ function hook_mail_alter(&$message) { > * A module may implement this hook in order to reorder the implementing > * modules, which are otherwise ordered by the module's system weight. > * > - * Note that hooks invoked using drupal_alter() can have multiple variations > - * (such as hook_form_alter() and hook_form_FORM_ID_alter()). drupal_alter() > - * will call all such variants defined by a single module in turn. For the > - * purposes of hook_module_implements_alter(), these variants are treated as > - * a single hook. Thus, to ensure that your implementation of > - * hook_form_FORM_ID_alter() is called at the right time, you will have to > - * change the order of hook_form_alter() implementation in > + * Note that hooks invoked using \Drupal::moduleHandler->alter() can have > + * multiple variations(such as hook_form_alter() and hook_form_FORM_ID_alter()). > + * \Drupal::moduleHandler->alter() will call all such variants defined by a > + * single module in turn. For the purposes of hook_module_implements_alter(), > + * these variants are treated as a single hook. Thus, to ensure that your > + * implementation of hook_form_FORM_ID_alter() is called at the right time, > + * you will have to change the order of hook_form_alter() implementation in > * hook_module_implements_alter(). > * > * @param $implementations 616a855,897 > diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module > index b3b8ad8..77e7783 100644 > --- a/core/modules/system/tests/modules/common_test/common_test.module > +++ b/core/modules/system/tests/modules/common_test/common_test.module > @@ -81,8 +81,8 @@ function bartik_drupal_alter_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) { > /** > * Implements hook_TYPE_alter() on behalf of block module. > * > - * This is for verifying that drupal_alter(array(TYPE1, TYPE2), ...) allows > - * hook_module_implements_alter() to affect the order in which module > + * This is for verifying that \Drupal::moduleHandler->alter()(array(TYPE1, TYPE2), ...) > + * allows hook_module_implements_alter() to affect the order in which module > * implementations are executed. > */ > function block_drupal_alter_foo_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) { > @@ -95,10 +95,10 @@ function block_drupal_alter_foo_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) { > * @see block_drupal_alter_foo_alter() > */ > function common_test_module_implements_alter(&$implementations, $hook) { > - // For drupal_alter(array('drupal_alter', 'drupal_alter_foo'), ...), make the > - // block module implementations run after all the other modules. Note that > - // when drupal_alter() is called with an array of types, the first type is > - // considered primary and controls the module order. > + // For \Drupal::moduleHandler()->alter(array('drupal_alter', 'drupal_alter_foo'), ...), > + // make the block module implementations run after all the other modules. Note > + // that when \Drupal::moduleHandler->alter() is called with an array of types, the > + // first type is considered primary and controls the module order. > if ($hook == 'drupal_alter_alter' && isset($implementations['block'])) { > $group = $implementations['block']; > unset($implementations['block']); > diff --git a/core/modules/system/tests/themes/test_theme/test_theme.theme b/core/modules/system/tests/themes/test_theme/test_theme.theme > index 9b10b2b..59555e1 100644 > --- a/core/modules/system/tests/themes/test_theme/test_theme.theme > +++ b/core/modules/system/tests/themes/test_theme/test_theme.theme > @@ -24,7 +24,7 @@ function test_theme_theme_test__suggestion($variables) { > * > * The confusing function name here is due to this being an implementation of > * the alter hook invoked when the 'theme_test' module calls > - * drupal_alter('theme_test_alter'). > + * \Drupal::moduleHandler->alter('theme_test_alter'). > */ > function test_theme_theme_test_alter_alter(&$data) { > $data = 'test_theme_theme_test_alter_alter was invoked';