kongondo / MenuBuilder

Easily create navigation lists/menus using drag and drop
GNU General Public License v2.0
21 stars 8 forks source link

Add possibility to use placeholders in currentClass #23

Closed tobaco closed 8 years ago

tobaco commented 9 years ago

proof of concept. you can now access fields and values from the menuitem page to output these in the menu markup. for now this only works in current_class/currentClass, but could/should be extended to other fields.

'current_class' => 'current {option} {option->value} {id} {identifier|name}',

shameless copy of parsePlaceholders function from MarkupSimpleNavigation.module (https://github.com/somatonic/MarkupSimpleNavigation/blob/master/MarkupSimpleNavigation.module#L307)

kongondo commented 8 years ago

Hi @tobaco. This is a good idea. I decided to cater for such needs a bit differently. I have implemented a getMenuItems() method that returns either an array or a Menu object WireArray from which you can create any sort of menu. It gives you access to the page ID of each menu item. You can use that in your menu building (recursive) function to access fields and their values before or as you build the menu. I've posted about it here including some examples. I am therefore closing this request. Thanks.