Standard Vanilla Drupal 7.8 install
node/add/page has "Main menu" as (only) active menu, no way to select other menu's.
enable hs_menu.module
node/add/page now has "Main menu", "Management", "Navigation" and "User menu" available.
problem: this is faulty behaviour, hs_menu completely ignores the "Available menus" setting defined in admin/structure/types/manage/page
What should happen is hs_menu should replicate what core Menu does,
trying a fix:
What I did in hierarchical_select.module is add the content type to $config['params'] in function form_hierarchical_select_process() when we are dealing with nodes. Next, in hs_menu.module, if a type is present in $params in function hs_menu_hierarchical_select_root_level(), I load the menu_options variable for that content type and thus only load the wanted menu's in the hierarchical select.
(patch created at Coworks)
Comment | File | Size | Author |
---|---|---|---|
#17 | 1271386-hs-menu-options.patch | 2.67 KB | agentrickard |
#12 | menu_options_correction-1271386-12.patch | 2.58 KB | rv0 |
#4 | menu_options_correction-4959370-4.patch | 2.53 KB | rv0 |
#3 | menu_options_correction.patch | 2.05 KB | rv0 |
menu_options.patch | 1.71 KB | rv0 | |
Comments
Comment #1
rv0 CreditAttribution: rv0 commentedComment #2
Wim LeersPlease move the content type detection code from hierarchical_select.module (which should remain general-purpose) to hs_menu.module's hs_menu_form_node_form_alter(). Then this is good to go :)
Comment #3
rv0 CreditAttribution: rv0 commentedEDIT:ignore patch below this, looking for the correct file
Comment #4
rv0 CreditAttribution: rv0 commentedgrr, took wrong file ;)
found it:
(patch created at Coworks)
Comment #5
Wim Leers- Why the array_key_exists() calls instead of isset()? isset() is more common in Drupal AFAIK. It's also shorter.
- Indentation is off here:
The last line should be indented to the same level as the first level.
- Please add some comments before
+ if (isset($params['type'])) {
Comment #6
rv0 CreditAttribution: rv0 commentedabout isset():
If I'm not mistaking it will throw warnings in some php configurations (when it checks if a non existing element has a value).
it is faster though.
Will research more thoroughly, I've been doing it like this for a long time, I'm not that worried about "longer" syntax ;)
Comment #7
Wim LeersWell, I just want to be consistent about it. I've used isset() everywhere, unless array_key_exists() is absolutely necessary. It'd be strange to start changing that.
Also, in principle, Drupal has the rule that every line should be max 80 chars long. I'm definitely not meeting that rule everywhere, but this change would cause us to go over the 80 chars limit in *a lot* of places.
Comment #8
Wim LeersI was waiting for this to be ready before tagging alpha 5. I decided it was more important to put alpha 5 in the hands of many people, so this one is for the next release :)
Comment #9
acbramley CreditAttribution: acbramley commentedCan a new patch be generated with the changes suggested in #5?
Comment #10
rv0 CreditAttribution: rv0 commented@Zombienaute
It's on my todo list, along with some other patches for HS I need to re-roll
Sadly, the todo list is quite long atm, so no ETA.
Comment #11
wiifmTried out patch #4, and this has solved the issue.
Thanks for your hard work here
Comment #12
rv0 CreditAttribution: rv0 commentedRerolled the patch against the latest git, including the changes proposed in #5
Comment #13
acbramley CreditAttribution: acbramley commentedWorks perfect!
Comment #15
mariomaric CreditAttribution: mariomaric commentedI can also confirm, patch from #12 works perfect!
Thx rv0!
P.S.
I applied it to alpha5, because it is newer version..
Comment #16
mariomaric CreditAttribution: mariomaric commentedIMHO this is bug.
And it is not compatible with patch from #1272538: Hierarchical Select Menu should also flatten on submit of node forms issue. :/
Comment #17
agentrickardHere's a reroll that applies after applying the patch from #1272538: Hierarchical Select Menu should also flatten on submit of node forms.
@mariomric
In the future, please be more specific than "is not compatible." That phrase could mean:
a) Patch does not apply.
b) Patch applies but breaks functionality.
Comment #18
mariomaric CreditAttribution: mariomaric commented@agentrickard: Will surely be more specific next time.
Thx for reroll. :)
Comment #19
agentrickardNot a problem. I just fine myself being more directive in the queue lately.
Turns out I won't be using HS on this project, so I'm leaving this issue ;-p.
Comment #20
Wim LeersFinally committed: http://drupalcode.org/project/hierarchical_select.git/commit/32d012c. Thanks!