Skip to content
Snippets Groups Projects
Commit 015fd044 authored by Ismael Posada Trobo's avatar Ismael Posada Trobo
Browse files

Prevent crashing website

Applying the latest release causes some websites (not all) to show 'the
website encountered an unexpected error' with no further information. The
watchdog shows:
php       RuntimeException: An invalid implementation
cern_integration_form_alter was added by hook_module_implements_alter() in
Drupal\Core\Extension\ModuleHandler->buildImplementationInfo() (line
error     https://dev-d8-rwmanos.web.cern.ch/

Although this additional if condition is not in the documentation example
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21module.api.php/function/hook_module_implements_alter/8.5.x

An example implementing it uses it, for instance,
https://api.drupal.org/api/drupal/core%21modules%21system%21tests%21modules%21common_test%21common_test.module/8.5.x
parent 51868ea9
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,7 @@ function cern_integration_form_user_register_form_alter(&$form, &$form_state, $f ...@@ -76,7 +76,7 @@ function cern_integration_form_user_register_form_alter(&$form, &$form_state, $f
* As this module injects a checkbox on user_form, cern_integration module must be unstacked. * As this module injects a checkbox on user_form, cern_integration module must be unstacked.
*/ */
function cern_integration_module_implements_alter(&$implementations, $hook) { function cern_integration_module_implements_alter(&$implementations, $hook) {
if ($hook == 'form_alter') { if ($hook == 'form_alter' && isset($implementations['cern_integration'])) {
// Move my_module_form_alter() to the end of the list. // Move my_module_form_alter() to the end of the list.
// \Drupal::moduleHandler()->getImplementations() // \Drupal::moduleHandler()->getImplementations()
// iterates through $implementations with a foreach loop which PHP iterates // iterates through $implementations with a foreach loop which PHP iterates
......
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