Skip to content
Snippets Groups Projects
Verified Commit da13608a authored by dpi's avatar dpi
Browse files

Issue #3257956 by dpi: Throw exception when an an unsupported Alter/Hook is implemented

parent c182adad
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,15 @@ class Alter {
) {
assert(!str_starts_with($alter, 'hook_'));
assert(!str_ends_with($alter, '_alter'));
if (in_array($alter, [
// This hook is invoked by \Drupal\Core\Extension\ModuleHandler::alter.
'module_implements_alter',
], TRUE)) {
// If this alter becomes supported, and Hux is still throwing this
// exception, then you can temporarily extend this class and constructor
// to workaround this check.
throw new \Exception($alter . ' is an unsupported alter implementation.');
}
}
}
......@@ -31,6 +31,18 @@ class Hook {
) {
// Specifically look for 'hook_' at position zero.
assert(strpos($hook, 'hook_') !== 0);
if (in_array($hook, [
// This hook is invoked by \Drupal\Core\Theme\Registry::processExtension.
// It is not converted to a moduleHandler->invoke* by the core patch since
// it needs to be able to invoke to module, theme engine, base theme
// engine, themes, etc.
'theme',
], TRUE)) {
// If this hook becomes supported, and Hux is still throwing this
// exception, then you can temporarily extend this class and constructor
// to workaround this check.
throw new \Exception($hook . ' is an unsupported hook implementation.');
}
}
}
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