Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
To reproduce:
- Clone the latest HEAD
- Hit admin/config/user-interface/shortcut/manage/default/add-link
- Give your shortcut a name but do NOT enter any custom path
- Hit Save
- Re-order your newly created shortcut
- Hit Save Changes
You should now be getting the below failure:
Drupal\Core\Entity\EntityStorageException: No matching route could be found for the path "" in Drupal\Core\Entity\ContentEntityDatabaseStorage->save() (line 623 of core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php).
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedAfter playing around with this for a bit, I think the issue has more to it than described in the initial post. Failed saving after reordering seems to be a side effect. The reproduction steps are valid, but the reordering is unneeded.
Any link with an empty path "" or the frontpage path "<front>" causes the shortcut set overview page to fail when saving all links using the "Save changes" button.
In shortcut_valid_link() a comment states that empty and front page links are valid for shortcuts. But when saving the list page, Url::createFromPath() is called and tries to resolve the "empty" link which off course fails.
When using "<front>" as path, a similar issue occurs. It seems like the "<front>" link is not properly read from the database, and becomes an empty string when evaluating the shortcut. I'm not sure if this should be a seperate issue though.
Comment #2
Wim LeersThis is being fixed as part of #2242535: Saving a shortcut set with empty or <front> link fails with an error.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commented@Wim Leers: your link points to this page. Could you correct it?
Comment #4
Wim LeersHah, oops!
I meant to link to #2235457: Use link field for shortcut entity — sorry!
Comment #5
Wim LeersAt the very least, this is postponed on #2235457: Use link field for shortcut entity. Once that lands, we should verify that it's indeed fixed, and if so, close this issue.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedAdding an empty path is no long possible, since the validation stops that. Using now works as expected by linking to the homepage.
If someone can verify this, we can close the issue.
Comment #7
dawehnerQuickly manually tested it and it seemed alright for me. Awesome.