Users Set the Parent Menu Item to "Add a main menu item"
clemens.tolboom - June 27, 2009 - 14:17
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | menu system |
| Category: | feature request |
| Priority: | normal |
| Assigned: | clemens.tolboom |
| Status: | won't fix |
| Issue tags: | d7uxsprint, ui-text usability |
Description
From http://drupalusability.org/node/123 we want to solve this with
Solution:
The "Add a main menu item" item should not be a real menu item. Instead it should be added through the theme layer when the menu is being displayed and the menu is empty.

#1
Patch contains a theme.inc check for an empty 'main_menu' and add the appropriate link taken from the removed menu_add in default.profile. Switching theme still shows the link for the main menu.
#2
#3
#4
#5
Patched tested and checked. Works as advertised.
Unassigning Clemens.
#6
The last submitted patch failed testing.
#7
Don't be a ponce, testing bot.
#8
#9
Looks great but the !count() should be an !isset().
#10
afaik we need count because in line 1941
<?php$variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array();
?>
is set to an empty array and
<?php// includes/menu.inc
function menu_main_menu() {
?>
returns an array.
But I haven't tested the toggle_main_menu yet :(
#11
Sorry, missed that, but in that case empty() should be fine.
#12
#13
- moved theme.inc code a few lines up
- included test for toggle_main_menu
- wrapped t() arround 'Add a main menu link'
#14
The last submitted patch failed testing.
#15
Not sure why this test failed.
#16
The last submitted patch failed testing.
#17
Rebuild patch
* The menu-item "Add a main menu item" for main-menu is just a link added through theme.inc
* When adding a menu-item to the main-menu this link disappears.
* When removing _all_ menu-items from main-menu this link appears.
* This is only available when main-menu is configured to show up.
#18
The last submitted patch failed testing.
#19
Bojhan adviced to postpone this feature. This feature is now confusing with regard to the toolbar.
#20
#21
According to #582734: Removal of Add a main menu link this could be closed. #473268: D7UX: Put edit links on everything adds links for everything :)