Currently, in the Menu administration page, the admin can set a default menu parent to be shown in the "Parent item" select box of a node's edit form.
I propose that we give the user the ability to explicitly choose which menu(s) appear in the "Parent item" select box. The advantage of this is that it would allow an administrator to control which menus are available to the creator of a node.
This patch adds a multi-select box to the menu administration page, which is used to choose which menus should be shown to the user, and then edits the menu_parent_options() function accordingly.
This patch intentionally does not affect admin pages, so the menu administration pages function normally.
Comment | File | Size | Author |
---|---|---|---|
#89 | menu.patch | 8.39 KB | catch |
#86 | 351249_parent_menu-86.patch | 8.46 KB | stBorchert |
#83 | 351249_parent_menu-83.patch | 8.56 KB | stBorchert |
#80 | 351249_parent_menu-80.patch | 8.42 KB | stBorchert |
#77 | node_add_after.png | 24.37 KB | sign |
Comments
Comment #2
coreyp_1 CreditAttribution: coreyp_1 commentedI'll try it again...
Comment #3
KarenS CreditAttribution: KarenS commentedNote that if we combine this with #273137: Split Navigation to User and Administration menu, we could then also set things up out of the box so that the administrative menu items don't show up as available parents when creating story and page nodes. Seeing all those admin items as options confused the heck out of people in the usability testing, so that would be a big win. Has anyone EVER added a story or page to the admin area? I sure haven't, but you have to stumble over all those options every time.
Comment #4
catchsubscribing.
Comment #5
wretched sinner - saved by grace CreditAttribution: wretched sinner - saved by grace commentedsubscribing
Comment #6
BrightLoudNoise CreditAttribution: BrightLoudNoise commentedPatch re-roll and screenshots showing the change for the patch averse.
Comment #7
BrightLoudNoise CreditAttribution: BrightLoudNoise commentedchanging status to needs review
Comment #8
catchTagging.
Comment #9
catchWe're about to try this at Usability testing after having major menu module issues.
Here's a slight update which removes the two default menu items from the default profile - because people were choosing these as menu parents thinking it'd create a new menu item (similar to how book module does in it's select list).
Also I think we should make the UI for selecting if a menu appears in the parent select a checkbox when editing a menu rather than in the settings tab.
Comment #10
catchfixing tag.
Comment #11
pwolanin CreditAttribution: pwolanin commentedI think we should move to the 2x select like the book module has - I hate the single chooser of the menu system.
Comment #12
catchMaybe revive #191360: Scalable menu selector ?
Comment #13
jstollersubscribing.
Comment #14
jstollerI'd like to see this enhancement include the appropriate hooks to allow modification of Parent select options based on user permissions, as well as node type. I'm looking for the ability to restrict where in the site hierarchy my users are allowed to put a node, based on who they are and what kind of content they are uploading.
For instance, here at the California Science Center, I want an exhibit curator to have complete freedom when it comes to creating content that deals with their exhibit gallery. However, they should only be able to put this content in the website section dealing with that exhibit gallery. Our Air & Space curator should never be given the option of sticking his page about the Apollo space capsule in the menu for our IMAX Theater. Every option in the Parent selector should be grayed-out except for those under the Air & Space Gallery section.
If you give users the option of making a mistake, they will make it. Maybe not all the time, but often enough.
Comment #15
wretched sinner - saved by grace CreditAttribution: wretched sinner - saved by grace commented@jstoller - would the idea of nested menus suit this? I don't know if it has been suggested before, or if it would fit with this issue, but could be a way of doing it.
The way I see it working is to create x menus which refer to different parts of the site, and then a special menu which has the other menus as it's children.
eg you have an Air & Space menu, an IMAX Theatre menu etc, which could then be grouped under one big Navigation menu which the administrator can build. Then you set permissions per menu, which delegates control but allows a constant, single site hierarcy.
Comment #16
jstollerNested menus might help in some cases, but I fear they would quickly become unmanageable. I can easily see a website degenerating in to a tangled mess of nested menus within nested menus, making it impossible to find anything. From a usability standpoint, it seems dangerous to break up the visual of a unified menu hierarchy.
I would prefer adding the ability to assign permissions to branches of the hierarchy directly. I see this happening in two complimentary ways. First, when I create a content type I should be able to restrict where in the menu hierarchy nodes of that type can be placed. Second, when I edit a menu item I should be able to restrict that branch of the menu to specific user roles. When creating a node of a given content type, the menu parent selector would only show menus that work with that content type and which my user roles allow me to access. Within a given menu, only the subset of the hierarchy which I (and the content type) can access should be selectable. The rest of the hierarchy must still be shown (so I know where I am in the site), but should be grayed-out.
This same idea should be carried over to the menu settings page as well. I should only be able to rearrange the subset of a menu's hierarchy that I have permission to manage. The rest of the menu items should be grayed-out and unmovable.
I expect some of these UI refinements could be done in contrib initially, as long as the underlying menu system is built to support the functionality.
Comment #17
beeradb CreditAttribution: beeradb commentedI think this all a bit of a derailment. The purpose of this patch is to simplify the UI, not make it overly complicated and allow you to allow you to use specific branches of the menu depending on user role, which is all doable in contrib anyway.
I think we should keep things simple here and offer one option per menu, which is whether or not it shows up as a parentable item.
Comment #18
pwolanin CreditAttribution: pwolanin commenteddidn't completely review #9, but this looks wrong:
Comment #19
jstollerI'm sorry I pulled this off topic with the user permissions angle, but I'm happy to hear it is possible to implement in contrib.
While I agree this patch is a step in the right direction, I do think it would greatly improve usability if the menus could be associated with content types, rather than just enabled or disabled for all parent selectors. However, I'm happy to request that feature in a separate issue.
Comment #20
mrugesh_drupal CreditAttribution: mrugesh_drupal commentedHi,
I use your patch it is nicely working but One problem related multilingual site is when I have created the page in dutch under primary-links menu to sub menu item. When i go to edit the page the sub menu do not come to be selected by default.
I am not pointing to your patch solution because by default in drupal case i got the same problem. So if you know the solution for that than please let me know.
As you can see in screen shot.
I have use i18n and language icons module for translations.
Thank you.
Comment #21
pwolanin CreditAttribution: pwolanin commentedplease don't change the title like that
Comment #22
eigentor CreditAttribution: eigentor commentedRelated issue: http://drupal.org/node/417106
Remove Management Menu from Parent Selection on Node Form
Comment #23
JohnAlbinpwolanin, what's a better way to check if we are in the admin section and, thus, need to override the "hide this menu" functionality?
$in_admin_page = arg(0) == 'admin';
works. But maybe we need to add a flag to toggle that behavior? :-\ Just thinking out loud.Comment #24
jix_ CreditAttribution: jix_ commentedTalked with kika about this and we came up with the attached mockup.
The design is definitely not considered ‘finished’ but we think the content type form is a very logical place for these settings. What are your thoughts?
Comment #25
jix_ CreditAttribution: jix_ commentedUpdated mockup with some textual changes and smart defaults.
Comment #26
kika CreditAttribution: kika commentedWe are progressing with the design. After discussion with Dries, Bohjan and Roy we keep the proposed design, just adding more clarity:
- By default, these are the default menu-is-enabled-in-node-add-menu settings per content type:
Main menu: enabled
Management: disabled
Navigation: disabled
Secondary menu: enabled
User menu: disabled
- When user adds new menu, the default menu-is-enabled-in-node-add-menu setting for each content type is enabled
Interaction:
- If user enables / disables menus to display, the default menu item dropdown contents will be updated dynamically -- adding and removing dropdown options
- When user have selected and item from the particular menu and then disables that menu, the default selection falls to the first element remaining in the dropdown
- When user have disabled all menus to display, all elements will be removed from the dropdown AND in node authoring page the "Menu settings" vertical tab is not displayed
Comment #27
jix_ CreditAttribution: jix_ commentedForgot to include the user menu — sorry.
Comment #28
mdupontSubscribing.
Comment #29
kika CreditAttribution: kika commentedkkaefer, how is it going with the patch?
Comment #30
rickvug CreditAttribution: rickvug commentedkika - I completely agree with all points in #26. A few questions:
- Do these limitations effect all users, including admin? Should permissions be taken into account?
- By default, should the article content type have any menus available? IMO, removing the menu fieldset/vertical tab could help ease some of the confusion regarding the difference between a page and article.
- Should there be an additional option to require adding a page to a menu item? Perhaps that is out of scope for this issue.
- (More kitten killing) Moving menu selection into vertical tabs doesn't always make sense if a content type requires it. For example, when creating a page the menu fieldset should be front and center. For content types that that normally do not require a menu, I think hiding the option in vertical tabs makes sense. Perhaps this could be tied to whether adding a menu is required. Alternately, re-arranging the menu form may be best addressed as part of the CCK UI or Fields UI in Core.
Comment #31
Bojhan CreditAttribution: Bojhan commentedDon't think anyone is working on this. Marking this crtical, since it causes a lot of initial usability problems.
- All users should be affected by this
- I think articles should have menus available.
- Out of scope
- Out of scope as well, this option should probally be tab 1 if required.
Comment #32
yoroy CreditAttribution: yoroy commentedcritical indeed.
Comment #33
stBorcherteigentor asked me to provide a patch for the last shown solution so here it is.
Comment #34
stBorchertsome screenshots.
#1 is showing the content type settings page with the new "menu settings" fieldset
#2 is showing the menu settings on node creation with pre-selected parent menu item and reduced option list
Comment #35
catchThis looks great, minor whitespace issue with
I'd like to add some variable_set() in the default install profile - to disable the management menu (probably others as well) - could maybe be a separate patch though.
Comment #36
stBorchertHm, don't know where these tabs came from. The editor is set up to use spaces only.
Anyway, here's a new patch with corrected whitespace.
Comment #37
catchSpotted a couple more things:
$menus is a parameter to the function, and then $available_menus is almost immediately reset when it's set to an empty array - shouldn't we be loaded it later only if needed? Only reading the patch out of context but it looks like we probably don't need to fetch the menus again at all.
authering -> authoring. No need to use a placeholder for %menu_settings
Comment #38
stBorchertOk, I've changed the code to take the given menu items and don't fetch them again.
Hm, I acted upon the last mockup in #27.
If you say "no emphasize" I'll go with it.
Comment #39
catchYou can happily put
<em>
tags inside t() strings if you want (same with strong etc.), no need to use placeholders for that.Comment #40
stBorchertOk, I've done it because "menu settings" is the title of the fieldset on node creation and I thought it will be more consistent to translate it only once :-).
But I'm ok with no placeholders.
Comment #41
catchOK really sorry this took three passes. The changes to content_types.inc should be in hook_form_node_type_form_alter() - menu module is optional whereas node module isn't, and it saves the module_exists() check. See http://api.drupal.org/api/function/comment_form_node_type_form_alter/7
Other than that looks RTBC to me.
Comment #42
stBorchertOk, now with
hook_form_FORM_ID_alter()
(don't know why I didnn't thought about it ...).Comment #43
catchLooks great now.
Comment #44
Bojhan CreditAttribution: Bojhan commentedSpend quite some time going over this, looking at the possible alternatives. But with the restraints, I feel this solution is good. I hope the sensible defaults of excluding management menu or whatever the toolbar uses is done correctly.
Looks RTBC from the UX perspective from me.
Comment #45
kika CreditAttribution: kika commentedJust skimming through the code:
- should we get rid of "Default menu for content" in admin/build/menu/settings ?
- what about upgrade path with that 'menu_default_node_menu' value populating fo all content types 'menu_parent_' . $type->type
- when I unselect all menus in content type form and submit, and try to add that content type node, I will get
"Notice: Undefined variable: options in menu_parent_options() (line 246 of /Users/kristjanjansen/Sites/drupal7/modules/menu/menu.module)."
This is wrong, instead the whole menu vertical tab should go away
- should not "Secondary menu" be enabled by default too?
- What becomes the default value when user selects a menu from the list what is not enabled?
(proposed interaction in #26: If user enables / disables menus to display, the default menu item dropdown contents will be updated dynamically -- adding and removing dropdown options; When user have selected and item from the particular menu and then disables that menu, the default selection falls to the first element remaining in the dropdown)
BTW, kkaefer was working on the same patch, can he provide his work so far?
Comment #46
kika CreditAttribution: kika commentedSo, obviously needs work
Comment #47
Bojhan CreditAttribution: Bojhan commented- should we get rid of "Default menu for content" in admin/build/menu/settings ?
Yes, but follow up?
- when I unselect all menus in content type form and submit, and try to add that content type node, I will get
bug
- should not "Secondary menu" be enabled by default too?
Not sure, because this is the default for all other themes as well.
- What becomes the default value when user selects a menu from the list what is not enabled?
The behavior you proposed, seems like the one we pursued?
Comment #48
stBorchertNext try.
This time it hides the vertical tab if there are no menus selected.
If you select a disabled menu item as parent it is pre-selected on node creation.
Comment #49
Dries CreditAttribution: Dries commentedWhile I like this patch, I think it does a poor job explaining what this setting is for. If I were a user new to Drupal, this fieldset would confuse me. There is no context.
Related to that: I don't understand "Menus which should appear in the add menu item section." What is the 'add menu item section'? On the node edit form it is called 'menu settings'?
Comment #50
Bojhan CreditAttribution: Bojhan commented-
Comment #51
Bojhan CreditAttribution: Bojhan commentedI think Dries is right.
"Menus which should appear in the add menu item section."
Should be something like "The menu's available to place links in for this content type.".
Also, why does Default parent item not update anymore on the given selection above?
We had a discussion at the UX-Sprint about this all : http://vimeo.com/groups/drupalux/videos/5676880
Comment #52
stBorchertOk, the latter description sounds much better.
Uhm, I never saw this before (or can't remember). Do you mean updating the default parent item based on the selected menus? Dynamically?
Comment #53
Bojhan CreditAttribution: Bojhan commentedYes, I was under the impression that - what I select influences the box below.
Comment #54
stBorchertHm, well. This has to be done dynamically.
I'll have to look into some code to figure out how to do this. Stay tuned.
Comment #55
kkaefer CreditAttribution: kkaefer commentedHere's a work in progress. There are still some UI glitches but it should work overall.
Comment #56
stBorchertHeres my try with dynamically loading the available default menu items.
Its a different approach to kkaefer's patch because it only show menu items from the currently selected menus and did not just disable them.
I know the code could be better (and should be cleaned up) but its a hint how it could look like.
If you deselect all menus, save the content type and then try to select a menu and save the content type again there is an error about an illegal option. Don't know how this can be avoided.
Comment #57
stBorchertUh, I forgot to include the new menu.admin.js. Now it should work (apart from this annoying "illegal choice" error).
Comment #58
Bojhan CreditAttribution: Bojhan commentedOke, looking good - probably needs some cleanup as the behavior is somewhat funky now sometimes. We do need to work on the indicator that it has changed.
Comment #59
Bojhan CreditAttribution: Bojhan commentedLets get some reviews up.
Comment #60
stBorchertWell, I did some more testing and found why its not working properly.
If you add some items to the select element ("Default parent item") the form element itself does not know anything about these new items.
Therefore the validation will fail if you select one of the new fields (because its key isn't in the options array of the select-element).
Question: how do we update
$form['menu']['menu_parent']['#options']
with the values returned bymenu_parent_options_js()
? Is this possible at all?If not, you can't update the available options in "Default parent items" after (de-)selecting one of the "Available menus" checkboxes via AJAX. You'll have to select the available menus first, save and then select the default parent item.
Thoughts?
Comment #61
stBorchertUpdate the patch: now there are no errors after selecting an item from the "Default parent item" dropdown that was added right before.
See #351249-34: Finer control over the Parent Menu select box for Screenshots (UI did not change).
Comment #63
mcrittenden CreditAttribution: mcrittenden commentedSubscribe.
Comment #64
stBorchertBot? Are you sure?
Comment #65
sign CreditAttribution: sign commentedReviewed, looks good, changed one line where atributes class should be an array.
Only one confusing thing for me was:
Main menu is the default menu selected. While adding content (node/add) I see a link called "Add a main menu link". Almost it looked like an action to add a new menu item that needs to be selected.
Comment #67
Bojhan CreditAttribution: Bojhan commentedThat is confusing but can be fixed elsewhere.
Comment #68
stBorchert@sign: you forgot to include menu.admin.js
Comment #69
sign CreditAttribution: sign commentedoops, sorry for that :( will make sure to always run patches against clean cvs checkout
reviewed, works fine for me
Comment #70
sign CreditAttribution: sign commentedComment #71
Bojhan CreditAttribution: Bojhan commentedI applied it, and it behaves as I expected it now.
Comment #72
Dries CreditAttribution: Dries commentedI don't understand why the menu settings aren't part of the Vertical Tabs? That is confusing me.
Comment #73
Bojhan CreditAttribution: Bojhan commentedVertical tabs got submitted in between the progress of this patch?
Comment #74
stBorchert@Dries: ah, ok. I simply forgot this :-)
Comment #75
stBorchertNew screenshots.
Comment #76
stBorchertOh and I forgot the new patch (menu.module has changed so it needed a re-roll).
Comment #77
sign CreditAttribution: sign commentedtested, works as expected, screenshots attached :)
Comment #78
kkaefer CreditAttribution: kkaefer commentedThere’s a > missing here.
Comment #79
kkaefer CreditAttribution: kkaefer commentedComment #80
stBorchertAdded the missing character.
Comment #81
Bojhan CreditAttribution: Bojhan commentedBack to RTBC, this has been reviewed many times now - lets get this sucker in.
Comment #83
stBorchertRerolled the patch.
Comment #84
Bojhan CreditAttribution: Bojhan commentedTime to put this back to RTBC.
Comment #85
Dries CreditAttribution: Dries commentedThis patch needs a bit more work.
We don't abbreviate variables to 'vals'. Write 'values' or 'items' or something else.
This isn't proper English.
Please describe why we prepare a dummy menu item.
Indentation is not according to the coding standards.
This needs some massaging. It reads like broken English. Also, "FormsAPI" should be "Form API".
I don't understand this code comment.
Comment #86
stBorchertHope this one is better.
Comment #87
eigentor CreditAttribution: eigentor commentedForget my comment. Installed the patch, fixes the issue I lamented about.
Comment #88
Dries CreditAttribution: Dries commentedOK, this looks good enough. Committed to CVS HEAD. We can refine in follow-ups as necessary.
Comment #89
catch#86 dealt with all of Dries' points. I found a couple of comments which had a summary more than one line, changed Javascript to JavaScript - rather than mark CNW I re-rolled the patches with these changes and am marking RTBC. Please don't credit on commit.
Comment #90
catchHeh.
None of those were major, we can do those in the 'fix code comments' issues in about a month.
Comment #92
Gábor HojtsyThis was not documented in the update guide, now added http://drupal.org/update/modules/6/7#menu_default_node_menu
Comment #93
Gábor HojtsyThis change is missing an upgrade path (although noted by @kika in July 2009 that it would need one). Critical issue opened at #761648: Menu D6->D7 upgrade doesn't maintain node-menu configuration (f.k.a.: Menu items disappear after upgrade or manual menu entry).