I found a neat way to disable a whole section of my site with 500 errors.
Steps to reproduce:
1. Create a basic page, "Foobar".
2. Give it a path of /foobar.
3. Give it a menu item.
3. Create a context triggered by /foobar and /foo/*
4. Add the active trail reaction for the menu item you just created.
5. Delete the page.
6. Create a new basic page with the same path.
7. Visit it. Your PHP log will be full of this: Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginNotFoundException: "Plugin ID 'menu_link_content:4d6a0c38-b009-43fb-bd06-fad06f25d643' was not found."
Expected behavior: no error, the active trail just shouldn't work anymore on the new /foobar page.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | context_active_trail-handle_missing_menu_links-2896272-1.patch | 878 bytes | drclaw |
Comments
Comment #2
drclaw commentedHere's a patch that catches the missing plugin error and uses the Drupal logger to log the error instead. There may be a more graceful way to do this but for now it at least takes care of the whitescreen :)
Comment #3
jurgenhaasThis is awesome. We ran into this same issue last night on a production site and it caused us a sleepless night until we found this report and patch. Thanks @drclaw, this is working just fine.
Comment #5
jigariusThis has been fixed in dev and will be included in the next release.
Comment #6
jigarius