When trying to add a menu_link, pointing to an external website, to a menu in Drupal the documentation tells you to use link_path where it has to be url.

I'll provide a small patch to update menu.api.php

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jeroen’s picture

Jeroen’s picture

Status: Active » Needs review
dawehner’s picture

Version: 8.0.0-beta7 » 8.0.x-dev
Status: Needs review » Reviewed & tested by the community

Thank you for fixing this particular problem!!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Nice catch. Committed and pushed to 8.0.x. Thanks!

  • webchick committed d403670 on 8.0.x
    Issue #2452995 by Jeroen: link_path should be url in the menu API...
jhodgdon’s picture

Status: Fixed » Needs work

This needs a quick follow-up. "url" is incorrect as a word. Should be "URL".

+++ b/core/modules/system/menu.api.php
@@ -337,9 +337,9 @@
  *   - title: (required) The untranslated title of the menu link.
  *   - description: The untranslated description of the link.
  *   - route_name: (optional) The route name to be used to build the path.
- *     Either a route_name or a link_path must be provided.
+ *     Either a route_name or a url must be provided.
  *   - route_parameters: (optional) The route parameters to build the path.
- *   - link_path: (optional) If you have an external link use link_path instead
+ *   - url: (optional) If you have an external link use url instead
  *     of providing a route_name.
  *   - parent: (optional) The machine name of the link that is this link's menu
  *     parent.

Both of the changed lines need this fix.

ashutoshsngh’s picture

Status: Needs work » Needs review
FileSize
872 bytes

Changed "url" to "URL" as mentioned in #6

jhodgdon’s picture

Status: Needs review » Needs work

Oh, my bad. So ... this text is confusing, because it is referring to array elements in text.

It should say something like "Either the route_name or url element must be provided".

JacobSanford’s picture

Status: Needs work » Needs review
FileSize
880 bytes
714 bytes

Changes as requested in #8

jhodgdon’s picture

Status: Needs review » Needs work

OK, good. Maybe here:

+ *   - url: (optional) If you have an external link use URL instead
  *     of providing a route_name.

it should say "... use this element instead of providing route_name"?

JacobSanford’s picture

Assigned: Unassigned » JacobSanford
Status: Needs work » Needs review
FileSize
1003 bytes
816 bytes

Thanks for the review!

Enclosed are new changes as recommended in #10 and interdiff from #9.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good now, thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 11: link_path_to_url-2452995-11.patch, failed testing.

JacobSanford’s picture

Status: Needs work » Reviewed & tested by the community

Patch tests clean again, setting to RTBTC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 9a668ad and pushed to 8.0.x. Thanks!

  • alexpott committed 9a668ad on 8.0.x
    Issue #2452995 by JacobSanford, ashutoshsngh, jhodgdon: link_path should...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.