- Issue created by @dasginganinja
- πΊπΈUnited States kevin w
Very helpful patch. I had to change `reset(array_keys($group_menus))` into `array_key_first($group_menus)` to avoid the PHP warning "Only variables should be passed by reference".
When creating group content via the special path or editing via node/nid/edit, nodes without a menu link (both core menu item content and group menu item content) the default menu parent link is set to the main menu (or whatever the defaults for the default-selected and available menu are.
I propose that we add a configurable option to allow menus to default to a group menu instead of a main menu.
There have been far too many times where my group content editors have added something to the main menu when they have access to both group and a wider range of menus on the site.
So when content is being created / edited in a group context I'd like to propose that we update the Node Form Alter to allow selection of the first group menu content is associated with.
Create or use page content type and set default menu to main menu.
Create a group content menu type.
Create a group type.
Add the group content menu type to the group as available content.
Add the page content type as available content.
Configure permissions so the editing user has "administer menus and menu items"
Create a group of this type.
Add a node to the group and observe that menu settings default to main menu.
This patch will update the default parent item to be the first available group menu.
This functionality would change default (expected) behavior and should be guarded behind a configuration option.
With the patch I have here it doesn't include a configuration form, but I propose we add one to allow this functionality for setting a group menu default. Maybe there's a better way to do it?
Active
3.0
Code
Very helpful patch. I had to change `reset(array_keys($group_menus))` into `array_key_first($group_menus)` to avoid the PHP warning "Only variables should be passed by reference".