Greetings,
I am working with an application of Panels that requires quite a bit of variation in the "Heading" the title displays as. I would like to be able to choose what heading level the title displays at through the gui instead of having to custom code something in a template override for each different pane. That would be a pain :D
I will be attaching a patch that gives this ability. Then these settings can then just be passed to the template file (Panels or anywhere else ctools is used).
This is just a proof of concept and may not be approached to Merlin's standards but it's a start for the conversation.
Thank you,
-Jesse
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | ctools_title_heading-2288741-17.patch | 4.7 KB | japerry |
Comments
Comment #1
dobe commentedComment #2
dobe commentedWoops didn't realize it would already list child issues.
Comment #4
michelleThis applies and works for customizing the heading of the title but the variable doesn't get passed thru to Panels with that patch. I don't know if the issue is with this patch or that one so leaving this at Needs Review for now.
Comment #5
dobe commentedThey both need applied. This one should fix your error for the other one.
-Jesse
Comment #6
michelleThey are both applied. I've been tracing through the code in the debugger trying to figure out how it's supposed to get into the template file and so far am not seeing it. I also tried with the built-in "powered by drupal" block in case it was an issue with the mini-panel I used the first time but no luck.
Comment #7
dobe commentedIs your theme overriding your panels-panel.tpl.php?
Comment #8
michelleNo, there is nothing custom on the site except whatever patch(es) I am currently testing and the associated contrib modules.
Comment #9
damienmckenna@dobe: reviewing this and the other patch, it looks like a title_heading value is only assigned when the form is set, therefore unless the form is set it won't have a value to output and would lead to broken HTML. You need to update this to provide a default value in the preprocessor.
Comment #10
dobe commentedOh weird my code has the preprocessor value. Ill get a patch re-rolled.
Comment #11
damienmckenna@dobe: and also ctools_content_render() needs to check for the existence of the variable, old records and exported displays wouldn't have it thus would give errors, like Michelle mentioned in #2288747: Panels Title Headings.
Comment #12
dobe commented@DamienMcKenna, my original already contains the ctools_content_render() it was only the preprocess value that needed added based on my test. Which @mrjmd in the other queue tackled before I could.
Comment #13
mrjmd commented@dobe, I think Damien is referring to the possibility that if a title is already overridden, and then this patch is applied, $conf['override_title_heading'] will not exist and will throw an error during render.
I tested this scenario and it is indeed the case. I'm attaching a patch to solve this problem.
Comment #14
mrjmd commentedComment #15
michelleI tested the patch in #13 along with this patch. I added content with an overridden title before applying the patches and it had no problems after the patches were applied. I then went in and changed it to h4 and the title successfully changed. Looks like these two are good to go. :)
Comment #16
dobe commentedRight on, good call. RTBC I suppose.
Comment #17
japerryOne issue is around plugins that declare their own markup tags. I've adjusted the patch to fix those plugins and harmonize the tag titles with the ones in those plugins.
Comment #19
japerryAfter talking with mrjmd, decided we shouldn't hide the field for those panes. So I pulled that out of the patch and committed the rest.
Comment #20
dobe commentedAwesome! Funny, a patch I figured was least likely to ever get in, got in. Another testament that you should always upload your work.
Comment #22
gmclelland commentedSo now that this is committed, how do I now change the default heading tags of my panes to an h3 instead of an h2?
I did
drush vset override_title_heading h3but it didn't change anything.Comment #23
gmclelland commentedI also tried adding $conf['override_title_heading'] = 'h3'; to my settings.php but it didn’t seem to work
Comment #24
gmclelland commentedFor those interested, here is a follow up issue #2488280: Can't override the default Pane title heading tag with a patch.
Comment #25
japerryRe-setting as needs work, I committed an update to allow title headings to work for ctools custom content, however it needs some CSS love.
Pushed the change because the CSS love is only in the admin modal. Probably is a quick fix.
Comment #27
gmclelland commented@japerry - just tested the commit. I'm now seeing the following when I edit a Panel's Page:
Notice: Undefined property: stdClass::$title_heading in _ctools_custom_content_type_content_type() (line 93 of /Users/glenn/websites/7c9d097f-0bc1-457d-8314-1d9e37f102bf/profiles/cmf/modules/contrib/ctools/plugins/content_types/custom/custom.inc). (x94)I have cleared the caches.
Comment #29
gmclelland commented@japerry - The latest dev fixes the Notice: Undefined property errors I was seeing.
Comment #30
japerryDrupal 7 is no longer supported, closing.