Skip to content
Snippets Groups Projects
Commit e8206cbd authored by catch's avatar catch
Browse files

Issue #2233261 by nicxvan, catch, berdir, andypost, sun: Deprecate...

Issue #2233261 by nicxvan, catch, berdir, andypost, sun: Deprecate hook_hook_info groups, mark hook_hook_info() for deletion
parent e45836d7
No related branches found
No related tags found
4 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!617Issue #3043725: Provide a Entity Handler for user cancelation
Pipeline #403640 canceled
......@@ -567,6 +567,7 @@ protected function getHookListeners(string $hook): array {
}
if (isset($this->groupIncludes[$hook])) {
foreach ($this->groupIncludes[$hook] as $include) {
@trigger_error('Autoloading hooks in the file (' . $include . ') is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Move the functions in this file to either the .module file or other appropriate location. See https://www.drupal.org/node/3489765', E_USER_DEPRECATED);
include_once $include;
}
}
......
......@@ -64,17 +64,15 @@
*
* Only procedural implementations are supported for this hook.
*
* Normally hooks do not need to be explicitly defined. However, by declaring a
* hook explicitly, a module may define a "group" for it. Modules that implement
* a hook may then place their implementation in either $module.module or in
* $module.$group.inc. If the hook is located in $module.$group.inc, then that
* file will be automatically loaded when needed.
* In general, hooks that are rarely invoked and/or are very large should be
* placed in a separate include file, while hooks that are very short or very
* frequently called should be left in the main module file so that they are
* always available.
*
* See system_hook_info() for all hook groups defined by Drupal core.
* Support for this hook will be removed in Drupal 12.0.0.
* This hook has intentionally not been deprecated since removing
* implementations will break modules with code in $module.$group.inc files.
*
* $module.$group.inc themselves have been deprecated, so modules supporting
* drupal 12.0.0 will have removed all code from $module.$group.inc files.
*
* Once a module requires 12.0.0 as a minimum version of Drupal the module can
* safely remove hook_hook_info() implementations.
*
* @return array
* An associative array whose keys are hook names and whose values are an
......
......@@ -384,9 +384,12 @@ public function testGetModuleDirectories(): void {
/**
* @covers ::getHookListeners
*
* @group legacy
*/
public function testGroupIncludes(): void {
self::setupGroupIncludes();
$this->expectDeprecation('Autoloading hooks in the file (vfs://drupal_root/test_module.tokens.inc) is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Move the functions in this file to either the .module file or other appropriate location. See https://www.drupal.org/node/3489765');
$moduleHandler = new ModuleHandler('', [], new EventDispatcher(), [], self::GROUP_INCLUDES);
$this->assertFalse(function_exists('_test_module_helper'));
$moduleHandler->invokeAll('token_info');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment