I was trying to create a menu item that used the replacement token [current-page:arg:1], which is not available at save time, causing an invalid link error.

Aren't menu items using tokens on the url spec mostly not-validable until they are used on the right place? The call to token_replace(...) will potentially lack most of it's values in menu_token_form_menu_edit_item_validate(...), won't it?

I solved my problem by ignoring the validation result, but I don't know if it would be a good solution to add a checkbox to skip the whole url validation.

Comments

dealancer’s picture

The validation should not be performed while saving - this has been solved in the dev version.

dealancer’s picture

Status: Active » Closed (fixed)
alfaguru’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
Status: Closed (fixed) » Active

I don't believe this is fixed. At least, if I try to save a menu item with tokens I get the message "The path 'mypathwithtokens' is either invalid or you do not have access to it.".

This occurs with 7.x-1.0-beta4 and the latest dev as of today.

MilOrg’s picture

I can confirm that the validation issue has not been solved in the dev version. Same error message.

maximpodorov’s picture

I confirm this problem also. Very annoying. Can it be solved?

khumbu’s picture

Same here,

You can create a new menu item with tokens and save it. But if you want to edit it, you get the "The path 'mypathwithtokens' is either invalid or you do not have access to it." error.

A workaround is to create a new menu item and delete to old one.

jcl324’s picture

Confirming. My work around is to just enter a known valid path with no token, save, then go back in and try again. But no matter what token I use, I can't get this module to work. It would be helpful to really know what the Method for Users option is and how it really should be used.

stiknoltz’s picture

Issue summary: View changes

I'm using 7.x-1.0-beta5 and it appears that on first save, there is no issue/error, but on subsequent updates, I get the same same result [the Path Invalid error[.

Current workaround is to save a valid path and uncheck the Use Tokens checkbox, then return, re-check the Use Tokens checkbox and add the updated tokenized path again.

erwangel’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta5

#8 (whoisinkus) worked for me. Thanks.

kevinquillen’s picture

Using this let me do it: https://www.drupal.org/project/any_menu_path

However, the link does not show. I am outputting a block on the user account page, and only static links will show.

watergate’s picture

Thanks for the tip whoisinkus (#8), solved my problem.

develcuy’s picture

Status: Active » Closed (outdated)