I was already using this module when i realized that it would be nice if some menu items can automatically link to their first child (just like someone else described here: http://drupal.org/node/433616). So, I wrote a patch that does this: if you enter 'firstchild' as path, the menu item automatically links to the first child. I hope you find this a useful addition to your module. I'm looking forward to any reactions and reviews.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | special_menu_items_firstchild.patch | 2.4 KB | marcvangend |
| special_menu_items_firstchild.patch | 2.4 KB | marcvangend |
Comments
Comment #1
marcvangendOops, I left a php syntax error in my patch. Use this one.
Comment #2
tamerzg commentedHi marcvangend ,
thank you for submitting the patch. We will review it and add it to next revision.
Comment #3
marcvangendI have found that my patch doesn't work correctly on a site with language prefixes.
Also, I noticed a new module (Menu Firstchild, http://drupal.org/project/menu_firstchild, first added less that 2 hours before I posted the patch above) which does the same thing, but in another way. I am not the only one who has noticed the kinship between Special Menu Items and Menu Firstchild; see http://drupal.org/node/515960. Maybe it should be considered if both modules can join forces?
Comment #4
tamerzg commentedHi,
I have tested your module. It is really nice feature to have. However I noticed a bug. If firstchild is submenu, then it will still point to firstchild dummy page. I traced the code and it seems that it will never enter if statement:
if ($branch['link']['mlid'] == $link['mlid']) {
$firstchild = array_shift($branch['below']);
break;
}
Also I tried it with Jquery menu and in there didn't work at all. Hope we can fix this, and we will add it in new release.
And yes, I have seen Menu Firstchild module. If author is interested in joining forces, I will be glad to accept him and give him CVS access.
Comment #5
tamerzg commentedOh yes, sometimes I got this error when saving firstchild item:
warning: array_shift() [function.array-shift]: The argument should be an array in C:\wamp\www\drupal611\sites\all\modules\special_menu_items\special_menu_items.module on line 114.
Comment #6
flaviovs commentedFYI: the Menu First Child module does exactly this.
Comment #7
gagarine commentedI will commit this for D7 if someone provide a patch. Please take a look at the implementation of Menu First Child (because it works and was tested a lot).
Comment #8
gagarine commentedAs say in 6 their is another module for that..