Problem/Motivation
Currently, there is no method to automatically expire all menus or newly-created menus. Further, a user must be granted the 'administer site configuration' permission into order to edit Expire's configuration. Less privileged users may have the 'administer menu' permission. This creates a situation where a user can create a menu but requires a site admin handle to Expire configuration.
Proposed resolution
Mimic Drupal core's block form to allow admins to designate through either inclusion or exclusion which menus should trigger expirations.
Remaining tasks
Create and post patch. The work is about 90% complete.
User interface changes
Modify the admin form to allow admins to designate selected menus to be either 1) included or 2) excluded. The language will be "Select which menus should expire their page urls when a menu is updated" with the respective options being 1) "Only the selected menus" and 2) "All menus except the selected menus". This behavior is modeled after Drupal core's block form.
The default will be 'included'. For each menu, there will be a checkbox to select the menu. If the checkbox is checked, then the 'depth' select box will be displayed. This is minor modification of existing behavior.
If 'excluded' is selected, then a 'default depth' checkbox will be presented. No individual depth settings will be presented. The default depth will be used for all menus (except those excluded, which won't trigger expire). This is new behavior.
I will post screenshots.
API changes
None
Data model changes
The 'expire_menu_link_override_menus' variable is a serialized array. Currently, it contains an array of menus with the menu name as the key and the depth as the value:
$conf['expire_menu_link_override_menus'] = array(
'devel' => '0',
'menu-og-1' => '4',
'main-menu' => '0',
'management' => '0',
'navigation' => '0',
'user-menu' => '0',
);
Proposed structure:
$conf['expire_menu_link_override_menus'] = array(
'select_type' => 'include',
'default_depth' => '1',
'menus' = array(
'devel' = array(
'select' => '0',
'depth' => '1',
),
'menu-og-1' = array(
'select' => '1',
'depth' => '4',
),
'main-menu' = array(
'select' => '0',
'depth' => '1',
),
'management' = array(
'select' => '0',
'depth' => '1',
),
'navigation' = array(
'select' => '0',
'depth' => '1',
),
'user-menu' = array(
'select' => '0',
'depth' => '1',
),
),
);
It is necessary to nest the menus inside 'menus' because it's possible for a namespace collision otherwise with 'select_type' and 'default_depth'. A hook_update_N() function will be used to convert the variable.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | expire-include_exclude-2531918-6-D7.patch | 5.45 KB | chris burge |
Comments
Comment #1
chris burge commentedScreenshots:
Comment #2
chris burge commentedComment #3
chris burge commentedFixed patch path to be relative to module's root.
Comment #4
chris burge commentedMInor bug fix that caused fatal error.
Comment #5
chris burge commentedFixed notice
Comment #6
chris burge commentedRemoved debug code