Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It would be nice to add new menu tokens which would allow to output menus using tokens (e.g. in blocks or even nodes using Token Filter module)
I created simple module that allows this, but it would be much nicer to integrate this (or make it a submodule) of Token module itself.
Please check https://github.com/m1n0/token_menu_render and let me know if you want to use it.
Comment | File | Size | Author |
---|---|---|---|
#1 | render-menu-using-tokens_2163679_1.patch | 2.68 KB | m1n0 |
Comments
Comment #1
m1n0 CreditAttribution: m1n0 commentedAlternatively, I created patch to include this in token module itself - can we discuss this please?
Comment #2
Dave ReidJust wanted to say this is really nice work. I can definitely see somehow we can move this forward.
I think that having a 'Token embeddables' module that contains all the embeddable things like blocks, menus, views, etc and controls them inside the [embed-menu:menu-name] or [embed-block:module-delta] namespace for tokens. I'm not sure if it's a separate contrib module, or a sub-module inside Token module yet.
Comment #3
Andy_Read CreditAttribution: Andy_Read commentedI was just looking for a menu equivalent to token_embed_views and was really surprised that this has only just been started in the last 6 weeks. m1n0's module is a very good starting point and works well as it stands. A worthy addition to token or as a stand-alone contrib module.
Just to 'push the envelope' I was interested in the possibility of embedding a menu with icons added using menu_icons, but this doesn't seem to be compatible with token_menu_render in its current form. I'd be interested to explore how to get these to work together.
Another useful extension would be to allow embedding tokens for sub-menus, i.e. children of a menu.
Comment #4
m1n0 CreditAttribution: m1n0 commentedThanks for your support guys - it seems that there are already some modules doing some token embeddable functionality though. Dave, do you think we could move this into token as a submodule and then add more 'embeddables' in future iterations (and after discussions which entities could/should be embeddedable)?
Comment #5
wizonesolutionsWhat became of this one? I'd love to see a contrib module with this functionality for the time being m1n0. Maybe it'd get merged into Token later. Could be called
token_embed_menus
and be Token Filter-compatible? :)Stuff like this is great for when we need to rush out content changes in a production environment but want to avoid using the PHP Code text format.
Comment #6
m1n0 CreditAttribution: m1n0 commentedI published the module - https://drupal.org/project/token_menu_render. This issue might be obsolete now, if there will be will to do more work on this together with token module, we shall start new issue.
Comment #7
m1n0 CreditAttribution: m1n0 commentedComment #8
m1n0 CreditAttribution: m1n0 as a volunteer commentedI believe we could reopen this and get this merged directly into Token - this way we do not need another contrib module.