It would be very nice to have ability to exclude from [menupath] hiden menus!
It is very actual with the advent of Category module and its hiden containers.

Thank you for the great module!

CommentFileSizeAuthor
#3 pa_menupath_only_visible.patch970 bytesgreggles

Comments

greggles’s picture

Priority: Critical » Normal

Can you describe the problem some more?

Also, I don't see this as critical, so I'm changing the priority to reflect that.

venkat-rk’s picture

vatavale, the category_pathauto module does this and more. Of course, it has some serious issues right now that need fixing, but once fixed, will work nicely.

greggles’s picture

Title: [menupath] improvement » only include visible menus in substitution for menupath
StatusFileSize
new970 bytes

vatavale - thanks for finding this issue. I figured out what you meant and have created the attached patch which I believe achieves what you desire.

Reading http://api.drupal.org/api/4.7/function/menu_get_menu it's pretty clear that visible is the only thing you are supposed to use most of the time. That was the solution here as well.

greggles’s picture

Status: Active » Reviewed & tested by the community

Forgot to change the status...

Stefan Nagtegaal’s picture

Go ahead Greggles, commit it to CVS..

greggles’s picture

Status: Reviewed & tested by the community » Fixed

committed to 4.7 and HEAD

Thanks vatavale and stefan

vatavale’s picture

Status: Fixed » Needs work

thank you greggles for patch, but after it another problem apear. It's look like http://drupal.org/node/75558
I have [menupath][nid].html for default path pattern and only 1.html -- 168.html generated.

vatavale’s picture

Status: Needs work » Fixed

Sorry. It's my fault. I forgot make hack for russian language transcoding.

vatavale’s picture

ok. after detailed testing:
after this patch [menupath] works only for categories and containers (category module)
But for page [menupath] return nothing (although breadcrumbs for this pages looks perfect).
Menu item for this pages are disabled (but it did not affect breadcrumbs).

It seems like only if "root" menu item is disabled then pathauto don't must generate aliases for this branch. But "leaf" (last in branch) menu item must not affect generation of aliases.

greggles’s picture

vatavale - I'm having a hard time following your last description.

I'm most concerned with this part:

Menu item for this pages are disabled (but it did not affect breadcrumbs).

Can you explain in more detail:

1. What the menu path is for the pages that don't seem to be work
2. Which levels in that menupath are enabled/disabled

Something like the following steps to repeat the situation that you have:

1. Use a node filter like [menupath]/[nid]
2. Create nodes root_node child1_node child2_node
3. Create a root menu item root_menu which is enabled and points to root_node
4. Create a menu item child1_menu which is a sub menu of the root_menu and which is disabled and which points to child1_node
5. Create a menu item child2_menu which is a sub menu of the child1_menu and is enabled/disabled and which points to child2_node
6. Bulk update node paths

Expected results (whatever they are)

Actual results (what happened that seemed wrong to you)

Thanks!

vatavale’s picture

Ok. It's easy:
1. Use a node filter like [menupath]_[nid].html
2. Create nodes firstnode secondnode thirdnode
3. Create a root menu item menu1 which is enabled and points to root_node
4. Create a menu item menu2 which is a sub menu of the root_menu and which is enabled and which points to child1_node
5. Create a menu item menu3 which is a sub menu of the child1_menu and is DISABLED and which points to child2_node
6. Bulk update node paths

Expected results:
firstnode: menu1_1.html
secondnode: menu1/menu2_2.html
thirdnode: menu1/menu2/menu3_3.html

Actual results (what happened that seemed wrong to you)
firstnode: menu1_1.html
secondnode: menu1/menu2_2.html
thirdnode: _3.html

Also i don't understand why when menu for thirdnode is disabled breadcrumbs show "home > menu1" but not "home > menu1 > menu2" ? I think it's a menu module bug?

vatavale’s picture

There are some errors in previous post.

1. Use a node filter like [menupath]_[nid].html
2. Create nodes firstnode secondnode thirdnode
3. Create a root menu item menu1 which is enabled and points to firstnode
4. Create a menu item menu2 which is a sub menu of the menu1 and which is enabled and which points to secondnode
5. Create a menu item menu3 which is a sub menu of the menu2 and is DISABLED and which points to thirdnode
6. Bulk update node paths

Expected results:
firstnode: menu1_1.html
secondnode: menu1/menu2_2.html
thirdnode: menu1/menu2/menu3_3.html

Actual results (what happened that seemed wrong to you)
firstnode: menu1_1.html
secondnode: menu1/menu2_2.html
thirdnode: _3.html

Also i don't understand why when menu for thirdnode is disabled breadcrumbs show "home > menu1" but not "home > menu1 > menu2" ? I think it's a menu module bug?

greggles’s picture

Status: Fixed » Needs work

vatavale - thanks for the very detailed explanation of what happened and what should have happened. It makes the job of fixing the problem so much easier!

So, this is an interesting problem and I have an idea on how to fix it. One comment though, on the expected path for the third node:

Expected results:
thirdnode: menu1/menu2/menu3_3.html

I would expect that one to be:
thirdnode: menu1/menu2/_3.html

Because the menu3 part is hidden. However, that's probably not the desired behavior, so here is the statement of the issue that I think we should follow:

When building a menu path, do not include hidden menu items in the path unless the hidden item is the menu for the node itself.
Does that seem reasonable?

Also, I'm setting the status back to "code needs work". And if you find that a patch fixes your problem please don't change the status to "fixed" unless you have committed the code to the CVS repository (something that only Steef and I can do at the moment). Otherwise it is confusing what happened.

Finally - menu/breadcrumb problems are very out of scope for pathauto.

vatavale’s picture

Yes, i think you right: thirdnode must be menu1/menu2/_3.html

dave reid’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Feature requests are bumped to 7.x-1.x/6.x-2.x now. 6.x-1.x is feature frozen.

dave reid’s picture

Status: Needs work » Fixed

This code no longer applies to pathauto and would need to be fixed in token.module. Please re-file an issue there if still necessary.

vatavale’s picture

Thank you -- i personally don't need this feature anymore.

Status: Fixed » Closed (fixed)

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