开发者

Add a Drupal menu item with a hard coded path to a view that accepts arguments?

开发者 https://www.devze.com 2022-12-21 16:10 出处:网络
I have a view page that accepts a taxonomy term id 开发者_高级运维as an argument at /foo/%bar. I want to add several menu items to the primary links in the form of /foo/actual-bar.

I have a view page that accepts a taxonomy term id 开发者_高级运维as an argument at /foo/%bar. I want to add several menu items to the primary links in the form of /foo/actual-bar.

Whenever I try to do this I get the error message "The path '/foo/actual-bar' is either invalid or you do not have access to it."

How can I add such menu items?

Thanks,

Finbarr


Off the top of my head I believe there are a couple ways to do this:

  1. Use absolute URLs (http://yoursite.com/foo/actual-bar) in the menu, which should bypass the check.

  2. Define the links in a custom module using hook_menu()

It does seem to me that there should be a better way to achieve this, but these two options should at least get your going in the short term.


Another way would be to set the url in the view to foo/% it makes the argument required and the 6.x menu system will then see it as a valid URL.

However, just /foo will no longer be a valid URL, so you may need to create another page display in the view to accommodate the URL with no argument.


i recommend set path in such way: /foo/%/bar so you can access it via: /foo/actual/bar


Oddly, I have a custom module that defines a hook_menu but the menu UI won't allow me to enter it into the system.

Had to do the absolute path solution... though I sure don't like it!

0

精彩评论

暂无评论...
验证码 换一张
取 消