Closed (won't fix)
Project:
Menu Rules
Version:
7.x-1.3
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Nov 2012 at 15:26 UTC
Updated:
25 Nov 2012 at 16:08 UTC
I'm trying to set up a rule to automatically create menu items for group content with Organic Groups. Essentially I'd like to specify the parent menu and the menu item for the group that node is a member of (for simplicity, let's just assume that content can only be a member of one group). Something like this:
node:og-membership:0:entity:menu-link:mlid
Which, obviously, doesn't work, otherwise I wouldn't be asking for help. The data selector stops at "entity:". Is something like that possible, or do I need to drop into PHP to do it (assuming that I'll be able to do it there)?
Comments
Comment #1
ordermind commentedIt seems to me that what would be needed is a callback that returns the group's menu item and sets the parent item to this value. As it is, there is no support for that in Menu Rules. However, feel free to create that functionality and post a patch!
Comment #2
colin_young commentedCan I do that in the PHP code? There are tokens that allow me to get the menu-link from a node, but could the problem be that entity in my selector is of type "group" while the rule is defined as having a condition of content is of type "group content" so rules doesn't know about "group"?
As for a patch, could you give some pointers where to start? It's been a little while since I've written any custom code for Drupal, and to say I'm a little rusty would be generous.
Comment #3
ordermind commentedYou need to read up on Rules API, for example at http://drupal.org/node/878718. I won't be able to help you with any more than that pointer, sorry.
Comment #3.0
ordermind commentedAdded some clarification as to why it doesn't work.