Problem/Motivation
In #3285496: Update Layout Builder panel size, Patternkit added a link-alter hook to customize links with route "layout_builder.add_block". If that hook tries to process a link without a route, Drupal logs an error like this:
UnexpectedValueException: https://www.drupal.org has no corresponding route. in Drupal\Core\Url->getRouteName() (line 574 of /var/www/web/core/lib/Drupal/Core/Url.php).
Steps to reproduce
- Install Drupal 11.2 with standard profile
- Install Patternkit (latest release 9.1.x-dev)
- In Drupal, add a menu item to the main menu (e.g., at /admin/structure/menu/manage/main/add).
- Use this external URL for that link: "https://www.drupal.org"
- Save it
- Go to /admin/reports/dblog.
- Notice that you see an error message of type "patternkit", with the error metioned above.
Proposed resolution
See proposed MR.
Remaining tasks
Review and testing
Release
Issue fork patternkit-3541404
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
sluceroGood catch @krisahil! Thank you for reporting this and posting the fix. I've made a couple of small tweaks for making sure array values exist and added unit tests for the class. With that, this should be ready for review and testing.
Comment #5
sluceroComment #6
krisahil commentedLGTM. Cannot reproduce original. bug report, after applying these changes.
Comment #8
sluceroMerged for inclusion in the 9.1.2 release.