Hi all,
I am new to this theme (BTW I really like it).
I just installed the theme, create my subtheme and enabled "Main Menu" under "admin/appearance/settings/mytheme". So the Main menu will be visible without setting any block.
Now I can see the Main menu, but it also shows the title "Main menu" above. I would like to hide this title, so the easiest way is to add a preprocess_page function to my subtheme and add 'element-invisible' class to the #heading variable.
The problem:
#heading variable has been set by default as a String, and my subtheme preprocess function doesn´t recognize it as an array where I can add 'class'.
Since Drupal by default will change #heading string into an array before printing it (at the end of the process), I think this variable should be treated as an array from the begining.
Please take a look at the patch, it will set this variable as an array from the begining with default settings for 'text' and 'level', so you can add 'class' or use other features.
Please review, comment... suggest, whatever!
It is my very first one patch, be kindly ;)
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | clean-preprocess-1301382-1.patch | 764 bytes | tuwebo |
| #2 | clean-preprocess-1301382-0.patch | 755 bytes | tuwebo |
Comments
Comment #1
tuwebo commentedHi all,
I solved it, now I can hide main_menu #heading with the 'element_invisible' class.
I have been making some research, and I found this piece of code in clean.preprocess.inc:
#heading is a string, so it is hard to set ['#heading']['class'] to 'element-invisible' in my theme´s preprocess function.
I have just changed (added) a couple of lines to see if it works:
Now I can add some code to the preprocess_page function in my subtheme.
Is this the right way? If this is the case, I will try to post a patch for it.
Comment #2
tuwebo commentedI have created a patch for the clean.preprocess.inc file, modifiyng Main menu and Secondary menu's #heading from a string to an array with 'text' and 'level' values set by default.
This way, mytheme_preprocess_page function can add the class 'element-invisible' and hide the title of the menu.
Could you please take a look a it and see if it makes sense for you?
This is my first patch created, so please be advised.
Thanks.
Comment #3
tuwebo commentedI have tested it, and so far it is working fine.
Have you tested it?
Changing the status to needs review.
Comment #4
tuwebo commentedSorry but there was an indenting problem in the patch. Here is the new one.
Hope it works.
Comment #5
tuwebo commentedChanging the title. Patch added, needs review.
Comment #6
tuwebo commentedDoes anyone tried the patch.
If someone did it, please report.
Thanks.
Comment #7
tuwebo commentedChanging the status.
Comment #8
psynaptic commentedI'm very sorry that I didn't deal with this before now. I have been a bad maintainer, very bad...
Thanks for the patch. I have committed it as-is.
http://drupalcode.org/project/clean.git/commit/d5a2f25
Comment #9
tuwebo commentedHey psynaptic!!
Really glad to see this patch commited, thanks very much!!
Comment #10
psynaptic commentedYou're welcome, thank YOU for the patch :D
Comment #11.0
(not verified) commentedMaking clear the issue summary