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
Comment #1
dealancer commentedThe validation should not be performed while saving - this has been solved in the dev version.
Comment #2
dealancer commentedComment #3
alfaguru commentedI 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.
Comment #4
MilOrg commentedI can confirm that the validation issue has not been solved in the dev version. Same error message.
Comment #5
maximpodorov commentedI confirm this problem also. Very annoying. Can it be solved?
Comment #6
khumbu commentedSame 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.
Comment #7
jcl324Confirming. 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.
Comment #8
stiknoltz commentedI'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.
Comment #9
erwangel commented#8 (whoisinkus) worked for me. Thanks.
Comment #10
kevinquillen commentedUsing 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.
Comment #11
watergate commentedThanks for the tip whoisinkus (#8), solved my problem.
Comment #12
develcuy commented