- last update
almost 2 years ago 6 pass
Currently the group content menu presumes all menu links are menu content link entities, what happens in most situations but not always.
As consequence, when you add a plugin based menu link, and go to edit the menu, you get the following error message:
Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "menu_link_content" for route "entity.group_content_menu.edit_link" must match "[^/]++" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 204 of core/lib/Drupal/Core/Routing/UrlGenerator.php).
Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute('entity.group_content_menu.edit_link', Object, Array, Array) (Line: 293)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('entity.group_content_menu.edit_link', Array, Array, 1) (Line: 105)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('entity.group_content_menu.edit_link', Array, Array, 1) (Line: 762)
Drupal\Core\Url->toString(1) (Line: 182)
Drupal\Core\Utility\LinkGenerator->generate(Object, Object) (Line: 95)
Drupal\Core\Render\Element\Link::preRenderLink(Array)
- Create a plugin based menu link. See:
https://www.drupal.org/docs/drupal-apis/menu-api/providing-module-define... →
- In the yaml definition, set the menu name properly. The group menu name will be GroupContentMenuInterface::MENU_PREFIX . $menu_group_content_id
- Go to your group > group menus > your menu > edit
- You will see the error above.
The error is caused by the code generating the operations, specifically the code generating the edit operation. Checking if the menu link is an instance of MenuLinkContentInterface should do the trick.
-
- Review
- Test
None
None
None
Needs work
1.0
Code
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.