When og_menu creates a new menu in og_menu_node_insert(), it calls menu_save(). Right now if a site wants to have those menus be translatable by default, they would probably have to implement a hook_menu_insert() to set the menu properties i18n_menu cares about. The problem is that $menu is an array and not one that can be altered by reference. So in order to get it to work you would have to ensure your modules hook happened after i18n_menu_menu_insert() and basically copy all the code from that into your hook once you set the right i18n_mode.
Instead it would be nice to allow administrators to set the default mode for new menus.
Comment | File | Size | Author |
---|---|---|---|
#2 | og_menu-set-i18n_mode_for_new_menus-2202653-2.patch | 3.8 KB | jojonaloha |
#1 | og_menu-set-i18n_mode_for_new_menus-2202653-1.patch | 2.85 KB | jojonaloha |
Comments
Comment #1
jojonaloha CreditAttribution: jojonaloha commentedThe attached patch creates a new setting on the OG Menu configuration form (/admin/config/group/og_menu) when i18n_menu is enabled.
It also updates the hook_node_insert() and hook_node_update() implementations to set the default mode before calling menu_save().
Comment #2
jojonaloha CreditAttribution: jojonaloha commentedThis updated patch also updates the og_menu_edit_menu_form() to include the i18n_menu elements, otherwise saving the form from the og menu edit page will lose these settings.
Comment #3
rv0 CreditAttribution: rv0 commentedBundling all i18n related issues.
Comment #4
fuerst CreditAttribution: fuerst commentedPatch #2 works, although I'm not sure if saving the default at a group node update in
og_menu_node_update()
is what one would expect. That way any menu customization will be set to the default again.Comment #5
fuerst CreditAttribution: fuerst commentedSomething like that can be used to update existing menus which still are set to I18N_MODE_NONE.
Comment #6
rv0 CreditAttribution: rv0 commentednever count on the menu name always being "menu-og-"
any menu can be attached to a group
Comment #7
rv0 CreditAttribution: rv0 commentedSee #2348821: OG Menu i18n combined patch