diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index be8c695..ca7bc62 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1953,39 +1953,25 @@ 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. - * * @deprecated as of Drupal 8.0. Use - * \Drupal::moduleHandler()->invoke($module, $hook, $args = array()). + * \Drupal::moduleHandler()->invoke($module, $hook). * - * @see drupal_alter() * @see \Drupal\Core\Extension\ModuleHandler::invoke() */ -function module_invoke($module, $hook) { - $args = func_get_args(); - // Remove $module and $hook from the arguments. - unset($args[0], $args[1]); - return \Drupal::moduleHandler()->invoke($module, $hook, $args); +function module_invoke($module, $hook, $context1 = NULL, $context2 = NULL, $context3 = NULL, $context4 = NULL) { + return \Drupal::moduleHandler()->invoke($module, $hook, $context1, $context2, $context3, $context4); } /** * 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. - * * @deprecated as of Drupal 8.0. Use * \Drupal::moduleHandler()->invokeAll($hook). * - * @see drupal_alter() * @see \Drupal\Core\Extension\ModuleHandler::invokeAll() */ -function module_invoke_all($hook) { - $args = func_get_args(); - // Remove $hook from the arguments. - array_shift($args); - return \Drupal::moduleHandler()->invokeAll($hook, $args); +function module_invoke_all($hook, $context1 = NULL, $context2 = NULL, $context3 = NULL, $context4 = NULL) { + return \Drupal::moduleHandler()->invokeAll($hook, $context1, $context2, $context3, $context4); } /** diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 98acf56..49178e8 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -104,7 +104,7 @@ function entity_invoke_bundle_hook($hook, $entity_type, $bundle, $bundle_new = N $storage_controller->$method($bundle, $bundle_new); } // Invoke hook_entity_bundle_*() hooks. - \Drupal::moduleHandler()->invokeAll('entity_bundle_' . $hook, array($entity_type, $bundle, $bundle_new)); + \Drupal::moduleHandler()->invokeAll('entity_bundle_' . $hook, $entity_type, $bundle, $bundle_new); } /** diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 144882b..c635ca6 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -620,7 +620,7 @@ function theme($hook, $variables = array()) { } // Invoke hook_theme_suggestions_HOOK(). - $suggestions = Drupal::moduleHandler()->invokeAll('theme_suggestions_' . $base_theme_hook, array($variables)); + $suggestions = Drupal::moduleHandler()->invokeAll('theme_suggestions_' . $base_theme_hook, $variables); // If theme() was invoked with a direct theme suggestion like // '#theme' => 'node__article', add it to the suggestions array before // invoking suggestion alter hooks. diff --git a/core/includes/update.inc b/core/includes/update.inc index f185036..f55750e 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -138,7 +138,7 @@ function update_system_schema_requirements() { */ function update_check_requirements($skip_warnings = FALSE) { // Check requirements of all loaded modules. - $requirements = \Drupal::moduleHandler()->invokeAll('requirements', array('update')); + $requirements = \Drupal::moduleHandler()->invokeAll('requirements', 'update'); $requirements += update_system_schema_requirements(); $requirements += update_settings_file_requirements(); $severity = drupal_requirements_severity($requirements); diff --git a/core/lib/Drupal/Core/Entity/EntityAccessController.php b/core/lib/Drupal/Core/Entity/EntityAccessController.php index 4873292..89b99f7 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessController.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessController.php @@ -72,8 +72,8 @@ public function access(EntityInterface $entity, $operation, $langcode = Language // - No modules say to deny access. // - At least one module says to grant access. $access = array_merge( - $this->moduleHandler()->invokeAll('entity_access', array($entity, $operation, $account, $langcode)), - $this->moduleHandler()->invokeAll($entity->getEntityTypeId() . '_access', array($entity, $operation, $account, $langcode)) + $this->moduleHandler()->invokeAll('entity_access', $entity, $operation, $account, $langcode), + $this->moduleHandler()->invokeAll($entity->getEntityTypeId() . '_access', $entity, $operation, $account, $langcode) ); if (($return = $this->processAccessHookResults($access)) === NULL) { @@ -219,8 +219,8 @@ public function createAccess($entity_bundle = NULL, AccountInterface $account = // - No modules say to deny access. // - At least one module says to grant access. $access = array_merge( - $this->moduleHandler()->invokeAll('entity_create_access', array($account, $context['langcode'])), - $this->moduleHandler()->invokeAll($this->entityTypeId . '_create_access', array($account, $context['langcode'])) + $this->moduleHandler()->invokeAll('entity_create_access', $account, $context['langcode']), + $this->moduleHandler()->invokeAll($this->entityTypeId . '_create_access', $account, $context['langcode']) ); if (($return = $this->processAccessHookResults($access)) === NULL) { @@ -288,7 +288,7 @@ public function fieldAccess($operation, FieldDefinitionInterface $field_definiti $grants = array(':default' => $default); $hook_implementations = $this->moduleHandler()->getImplementations('entity_field_access'); foreach ($hook_implementations as $module) { - $grants = array_merge($grants, array($module => $this->moduleHandler()->invoke($module, 'entity_field_access', array($operation, $field_definition, $account, $items)))); + $grants = array_merge($grants, array($module => $this->moduleHandler()->invoke($module, 'entity_field_access', $operation, $field_definition, $account, $items))); } // Also allow modules to alter the returned grants/denies. diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index 342d395..3c2c92b 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -412,10 +412,9 @@ protected function prepareInvokeAll($hook, array &$form_state) { foreach ($implementations as $module) { $function = $module . '_' . $hook; if (function_exists($function)) { - // Ensure we pass an updated translation object and form display at - // each invocation, since they depend on form state which is alterable. - $args = array($this->entity, $this->getFormDisplay($form_state), $this->operation, &$form_state); - call_user_func_array($function, $args); + // Ensure to pass an updated form display at each invocation, since it + // depends on form state which is alterable. + $function($this->entity, $this->getFormDisplay($form_state), $this->operation, $form_state); } } } diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 8f7e929..06e7717 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -337,7 +337,7 @@ public function getFieldDefinitions($entity_type, $bundle = NULL) { // Invoke hooks. $result = $this->moduleHandler->invokeAll($entity_type . '_field_info'); $this->entityFieldInfo[$entity_type] = NestedArray::mergeDeep($this->entityFieldInfo[$entity_type], $result); - $result = $this->moduleHandler->invokeAll('entity_field_info', array($entity_type)); + $result = $this->moduleHandler->invokeAll('entity_field_info', $entity_type); $this->entityFieldInfo[$entity_type] = NestedArray::mergeDeep($this->entityFieldInfo[$entity_type], $result); // Automatically set the field name for non-configurable fields. diff --git a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php index 5427501..858b4a9 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php @@ -148,9 +148,9 @@ protected function cacheSet($entities) { */ protected function invokeHook($hook, EntityInterface $entity) { // Invoke the hook. - $this->moduleHandler()->invokeAll($this->entityTypeId . '_' . $hook, array($entity)); + $this->moduleHandler()->invokeAll($this->entityTypeId . '_' . $hook, $entity); // Invoke the respective entity-level hook. - $this->moduleHandler()->invokeAll('entity_' . $hook, array($entity, $this->entityTypeId)); + $this->moduleHandler()->invokeAll('entity_' . $hook, $entity, $this->entityTypeId); } /** diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index ef7b5e7..7893662 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -264,33 +264,30 @@ public function implementsHook($module, $hook) { /** * Implements \Drupal\Core\Extension\ModuleHandlerInterface::invoke(). */ - public function invoke($module, $hook, array $args = array()) { + public function invoke($module, $hook, $context1 = NULL, $context2 = NULL, $context3 = NULL, $context4 = NULL) { if (!$this->implementsHook($module, $hook)) { return; } $function = $module . '_' . $hook; - return call_user_func_array($function, $args); + return $function($context1, $context2, $context3, $context4); } /** * Implements \Drupal\Core\Extension\ModuleHandlerInterface::invokeAll(). */ - public function invokeAll($hook, array $args = array()) { + public function invokeAll($hook, $context1 = NULL, $context2 = NULL, $context3 = NULL, $context4 = NULL) { $return = array(); $implementations = $this->getImplementations($hook); foreach ($implementations as $module) { $function = $module . '_' . $hook; - if (function_exists($function)) { - $result = call_user_func_array($function, $args); - if (isset($result) && is_array($result)) { - $return = NestedArray::mergeDeep($return, $result); - } - elseif (isset($result)) { - $return[] = $result; - } + $result = $function($context1, $context2, $context3, $context4); + if (isset($result) && is_array($result)) { + $return = NestedArray::mergeDeep($return, $result); + } + elseif (isset($result)) { + $return[] = $result; } } - return $return; } @@ -619,7 +616,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { drupal_theme_rebuild(); // Allow modules to react prior to the installation of a module. - $this->invokeAll('module_preinstall', array($module)); + $this->invokeAll('module_preinstall', $module); // Clear the entity info cache before importing new configuration. entity_info_cache_clear(); @@ -658,7 +655,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { // If any modules were newly installed, invoke hook_modules_installed(). if (!empty($modules_installed)) { - $this->invokeAll('modules_installed', array($modules_installed)); + $this->invokeAll('modules_installed', $modules_installed); } return TRUE; @@ -719,7 +716,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { $schema_store = \Drupal::keyValue('system.schema'); foreach ($module_list as $module) { // Allow modules to react prior to the uninstallation of a module. - $this->invokeAll('module_preuninstall', array($module)); + $this->invokeAll('module_preuninstall', $module); // Uninstall the module. module_load_install($module); @@ -763,7 +760,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { drupal_get_installed_schema_version(NULL, TRUE); // Let other modules react. - $this->invokeAll('modules_uninstalled', array($module_list)); + $this->invokeAll('modules_uninstalled', $module_list); drupal_flush_all_caches(); diff --git a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php index a74f9cd..c58691a 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php @@ -179,27 +179,43 @@ public function implementsHook($module, $hook); * The name of the module (without the .module extension). * @param string $hook * The name of the hook to invoke. - * @param ... - * Arguments to pass to the hook implementation. + * @param mixed $context1 + * (optional) A variable to pass to the implementation. + * @param mixed $context2 + * (optional) An additional variable to pass to the implementation. + * @param mixed $context3 + * (optional) An additional variable to pass to the implementation. + * @param mixed $context4 + * (optional) An additional variable to pass to the implementation. If more + * context needs to be provided to implementations, then this should be an + * associative array. * * @return mixed * The return value of the hook implementation. */ - public function invoke($module, $hook, array $args = array()); + public function invoke($module, $hook, $context1 = NULL, $context2 = NULL, $context3 = NULL, $context4 = NULL); /** * Invokes a hook in all enabled modules that implement it. * * @param string $hook * The name of the hook to invoke. - * @param array $args - * Arguments to pass to the hook. + * @param mixed $context1 + * (optional) A variable to pass to the implementation. + * @param mixed $context2 + * (optional) An additional variable to pass to the implementation. + * @param mixed $context3 + * (optional) An additional variable to pass to the implementation. + * @param mixed $context4 + * (optional) An additional variable to pass to the implementation. If more + * context needs to be provided to implementations, then this should be an + * associative array. * * @return array * An array of return values of the hook implementations. If modules return * arrays from their implementations, those are merged into one array. */ - public function invokeAll($hook, array $args = array()); + public function invokeAll($hook, $context1 = NULL, $context2 = NULL, $context3 = NULL, $context4 = NULL); /** * Passes alterable variables to specific hook_TYPE_alter() implementations. diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index 7c71eba..aac83a2 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -153,7 +153,7 @@ public function enable(array $theme_list) { $this->resetSystem(); // Invoke hook_themes_enabled() after the themes have been enabled. - $this->moduleHandler->invokeAll('themes_enabled', array($theme_list)); + $this->moduleHandler->invokeAll('themes_enabled', $theme_list); } /** @@ -184,7 +184,7 @@ public function disable(array $theme_list) { $this->resetSystem(); // Invoke hook_themes_disabled after the themes have been disabled. - $this->moduleHandler->invokeAll('themes_disabled', array($theme_list)); + $this->moduleHandler->invokeAll('themes_disabled', $theme_list); } /** diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 43d15a6..6020589 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -510,7 +510,7 @@ public function retrieveForm($form_id, &$form_state) { // So, we call the hook if $this->forms isn't yet populated, OR if it // doesn't yet have an entry for the requested form_id. if (!isset($this->forms) || !isset($this->forms[$form_id])) { - $this->forms = $this->moduleHandler->invokeAll('forms', array($form_id, $args)); + $this->forms = $this->moduleHandler->invokeAll('forms', $form_id, $args); } $form_definition = $this->forms[$form_id]; if (isset($form_definition['callback arguments'])) { diff --git a/core/lib/Drupal/Core/Utility/Token.php b/core/lib/Drupal/Core/Utility/Token.php index 29fef78..1e0529c 100644 --- a/core/lib/Drupal/Core/Utility/Token.php +++ b/core/lib/Drupal/Core/Utility/Token.php @@ -213,7 +213,7 @@ public function scan($text) { */ public function generate($type, array $tokens, array $data = array(), array $options = array()) { $options += array('sanitize' => TRUE); - $replacements = $this->moduleHandler->invokeAll('tokens', array($type, $tokens, $data, $options)); + $replacements = $this->moduleHandler->invokeAll('tokens', $type, $tokens, $data, $options); // Allow other modules to alter the replacements. $context = array( diff --git a/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php b/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php index ebd2623..cbd641b 100644 --- a/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php +++ b/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php @@ -240,7 +240,7 @@ public function buildForm(array $form, array &$form_state, $type = 'new') { 'options' => $comment_uri['options'], 'query' => $destination, ); - if ($this->moduleHandler->invoke('content_translation', 'translate_access', array($comment))) { + if ($this->moduleHandler->invoke('content_translation', 'translate_access', $comment)) { $links['translate'] = array( 'title' => $this->t('translate'), 'route_name' => 'content_translation.translation_overview_comment', diff --git a/core/modules/edit/lib/Drupal/edit/EditController.php b/core/modules/edit/lib/Drupal/edit/EditController.php index d7c8386..cee57e7 100644 --- a/core/modules/edit/lib/Drupal/edit/EditController.php +++ b/core/modules/edit/lib/Drupal/edit/EditController.php @@ -323,8 +323,7 @@ public function renderField(EntityInterface $entity, $field_name, $langcode, $vi // by a dash; the first part must be the module name. $mode_id_parts = explode('-', $view_mode_id, 2); $module = reset($mode_id_parts); - $args = array($entity, $field_name, $view_mode_id, $langcode); - $output = $this->moduleHandler->invoke($module, 'edit_render_field', $args); + $output = $this->moduleHandler->invoke($module, 'edit_render_field', $entity, $field_name, $view_mode_id, $langcode); } return drupal_render($output); diff --git a/core/modules/field/field.purge.inc b/core/modules/field/field.purge.inc index cd8cd04..7aef0b9 100644 --- a/core/modules/field/field.purge.inc +++ b/core/modules/field/field.purge.inc @@ -150,7 +150,7 @@ function field_purge_instance($instance) { field_info_cache_clear(); // Invoke external hooks after the cache is cleared for API consistency. - \Drupal::moduleHandler()->invokeAll('field_purge_instance', array($instance)); + \Drupal::moduleHandler()->invokeAll('field_purge_instance', $instance); } /** @@ -180,7 +180,7 @@ function field_purge_field($field) { field_info_cache_clear(); // Invoke external hooks after the cache is cleared for API consistency. - \Drupal::moduleHandler()->invokeAll('field_purge_field', array($field)); + \Drupal::moduleHandler()->invokeAll('field_purge_field', $field); } /** diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc index 172aee4..96007f5 100644 --- a/core/modules/field/field.views.inc +++ b/core/modules/field/field.views.inc @@ -22,7 +22,7 @@ function field_views_data() { foreach (field_info_fields() as $field) { if (_field_views_is_sql_entity_type($field)) { - $result = (array) $module_handler->invoke($field->module, 'field_views_data', array($field)); + $result = (array) $module_handler->invoke($field->module, 'field_views_data', $field); if (empty($result)) { $result = field_views_field_default_views_data($field); } diff --git a/core/modules/field/lib/Drupal/field/Entity/Field.php b/core/modules/field/lib/Drupal/field/Entity/Field.php index 3e5a63f..110f085 100644 --- a/core/modules/field/lib/Drupal/field/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Entity/Field.php @@ -365,7 +365,7 @@ protected function preSaveUpdated(EntityStorageControllerInterface $storage_cont // See if any module forbids the update by throwing an exception. This // invokes hook_field_update_forbid(). - $module_handler->invokeAll('field_update_forbid', array($this, $this->original)); + $module_handler->invokeAll('field_update_forbid', $this, $this->original); // Notify the storage controller. The controller can reject the definition // update as invalid by raising an exception, which stops execution before diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 892b214..d73ff83 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -189,7 +189,7 @@ function file_copy(File $source, $destination = NULL, $replace = FILE_EXISTS_REN $file->save(); // Inform modules that the file has been copied. - \Drupal::moduleHandler()->invokeAll('file_copy', array($file, $source)); + \Drupal::moduleHandler()->invokeAll('file_copy', $file, $source); return $file; } @@ -264,7 +264,7 @@ function file_move(File $source, $destination = NULL, $replace = FILE_EXISTS_REN $file->save(); // Inform modules that the file has been moved. - \Drupal::moduleHandler()->invokeAll('file_move', array($file, $source)); + \Drupal::moduleHandler()->invokeAll('file_move', $file, $source); // Delete the original if it's not in use elsewhere. if ($delete_source && !\Drupal::service('file.usage')->listUsage($source)) { @@ -308,7 +308,7 @@ function file_validate(File $file, $validators = array()) { } // Let other modules perform validation on the new file. - return array_merge($errors, \Drupal::moduleHandler()->invokeAll('file_validate', array($file))); + return array_merge($errors, \Drupal::moduleHandler()->invokeAll('file_validate', $file)); } /** diff --git a/core/modules/help/lib/Drupal/help/Controller/HelpController.php b/core/modules/help/lib/Drupal/help/Controller/HelpController.php index 7aac826..d5a0e06 100644 --- a/core/modules/help/lib/Drupal/help/Controller/HelpController.php +++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php @@ -69,7 +69,7 @@ protected function helpLinksAsList() { $modules = array(); foreach ($this->moduleHandler->getImplementations('help') as $module) { - if ($this->moduleHandler->invoke($module, 'help', array("admin/help#$module", $empty_arg))) { + if ($this->moduleHandler->invoke($module, 'help', "admin/help#$module", $empty_arg)) { $modules[$module] = $module_info[$module]->info['name']; } } @@ -109,7 +109,7 @@ public function helpPage($name) { $info = system_get_info('module'); $build['#title'] = String::checkPlain($info[$name]['name']); - $temp = $this->moduleHandler->invoke($name, 'help', array("admin/help#$name", drupal_help_arg())); + $temp = $this->moduleHandler->invoke($name, 'help', "admin/help#$name", drupal_help_arg()); if (empty($temp)) { $build['top']['#markup'] = t('No help is available for module %module.', array('%module' => $info[$name]['name'])); } diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 3751b8c..ff212cb 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -239,7 +239,7 @@ function image_file_download($uri) { $image = \Drupal::service('image.factory')->get($uri); if ($image->isSupported()) { // Check the permissions of the original to grant access to this image. - $headers = \Drupal::moduleHandler()->invokeAll('file_download', array($original_uri)); + $headers = \Drupal::moduleHandler()->invokeAll('file_download', $original_uri); // Confirm there's at least one module granting access and none denying access. if (!empty($headers) && !in_array(-1, $headers)) { return array( diff --git a/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php b/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php index 3c619ff..500063e 100644 --- a/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php +++ b/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php @@ -110,7 +110,7 @@ public function deliver(Request $request, $scheme, ImageStyleInterface $image_st return parent::download($request, $scheme); } else { - $headers = $this->moduleHandler()->invokeAll('file_download', array($image_uri)); + $headers = $this->moduleHandler()->invokeAll('file_download', $image_uri); if (in_array(-1, $headers) || empty($headers)) { throw new AccessDeniedHttpException(); } diff --git a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php index 506f660..4db4006 100644 --- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php @@ -255,7 +255,7 @@ public function flush($path = NULL) { // Let other modules update as necessary on flush. $module_handler = \Drupal::moduleHandler(); - $module_handler->invokeAll('image_style_flush', array($this)); + $module_handler->invokeAll('image_style_flush', $this); // Clear field caches so that formatters may be added for this style. field_info_cache_clear(); diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 8d0faab..a81a173 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -471,7 +471,7 @@ function language_save($language) { $language->is_new = $language_entity->isNew(); // Let other modules modify $language before saved. - \Drupal::moduleHandler()->invokeAll('language_presave', array($language)); + \Drupal::moduleHandler()->invokeAll('language_presave', $language); // Assign language properties to language entity. $language_entity->label = isset($language->name) ? $language->name : ''; @@ -484,11 +484,11 @@ function language_save($language) { $language_entity->save(); $t_args = array('%language' => $language->name, '%langcode' => $language->id); if ($language->is_new) { - \Drupal::moduleHandler()->invokeAll('language_insert', array($language)); + \Drupal::moduleHandler()->invokeAll('language_insert', $language); watchdog('language', 'The %language (%langcode) language has been created.', $t_args); } else { - \Drupal::moduleHandler()->invokeAll('language_update', array($language)); + \Drupal::moduleHandler()->invokeAll('language_update', $language); watchdog('language', 'The %language (%langcode) language has been updated.', $t_args); } @@ -532,7 +532,7 @@ function language_delete($langcode) { if (isset($languages[$langcode]) && !$languages[$langcode]->locked) { $language = $languages[$langcode]; - \Drupal::moduleHandler()->invokeAll('language_delete', array($language)); + \Drupal::moduleHandler()->invokeAll('language_delete', $language); // Remove the language. entity_delete_multiple('language_entity', array($language->id)); diff --git a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SourcePluginBase.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SourcePluginBase.php index 0efc013..78eb2fa 100644 --- a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SourcePluginBase.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/source/SourcePluginBase.php @@ -46,8 +46,8 @@ protected function getModuleHandler() { * {@inheritdoc} */ public function prepareRow(Row $row) { - $this->getModuleHandler()->invokeAll('migrate_prepare_row', array($row, $this, $this->migration)); - $this->getModuleHandler()->invokeAll('migrate_ '. $this->migration->id() . '_prepare_row', array($row, $this, $this->migration)); + $this->getModuleHandler()->invokeAll('migrate_prepare_row', $row, $this, $this->migration); + $this->getModuleHandler()->invokeAll('migrate_ '. $this->migration->id() . '_prepare_row', $row, $this, $this->migration); return TRUE; } diff --git a/core/modules/node/lib/Drupal/node/Controller/NodeController.php b/core/modules/node/lib/Drupal/node/Controller/NodeController.php index 4d62d12..5901dbe 100644 --- a/core/modules/node/lib/Drupal/node/Controller/NodeController.php +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php @@ -63,7 +63,7 @@ public function addPage() { */ public function add(NodeTypeInterface $node_type) { $account = $this->currentUser(); - $langcode = $this->moduleHandler()->invoke('language', 'get_default_langcode', array('node', $node_type->type)); + $langcode = $this->moduleHandler()->invoke('language', 'get_default_langcode', 'node', $node_type->type); $node = $this->entityManager()->getStorageController('node')->create(array( 'uid' => $account->id(), diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php index a069854..0d7940a1 100644 --- a/core/modules/node/lib/Drupal/node/NodeAccessController.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php @@ -127,7 +127,7 @@ protected function checkCreateAccess(AccountInterface $account, array $context, * {@inheritdoc} */ public function acquireGrants(NodeInterface $node) { - $grants = $this->moduleHandler->invokeAll('node_access_records', array($node)); + $grants = $this->moduleHandler->invokeAll('node_access_records', $node); // Let modules alter the grants. $this->moduleHandler->alter('node_access_records', $grants, $node); // If no grants are set and the node is published, then use the default grant. diff --git a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php index 8a7e30a..82dc819 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php @@ -238,9 +238,9 @@ public function execute() { $node->rendered = drupal_render($build); // Fetch comment count for snippet. - $node->rendered .= ' ' . $this->moduleHandler->invoke('comment', 'node_update_index', array($node, $item->langcode)); + $node->rendered .= ' ' . $this->moduleHandler->invoke('comment', 'node_update_index', $node, $item->langcode); - $extra = $this->moduleHandler->invokeAll('node_search_result', array($node, $item->langcode)); + $extra = $this->moduleHandler->invokeAll('node_search_result', $node, $item->langcode); $language = language_load($item->langcode); $username = array( @@ -337,7 +337,7 @@ protected function indexNode(EntityInterface $node) { $text = '