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

Comments

dobe’s picture

StatusFileSize
new2.28 KB
dobe’s picture

Woops didn't realize it would already list child issues.

michelle’s picture

This 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.

dobe’s picture

They both need applied. This one should fix your error for the other one.

-Jesse

michelle’s picture

They 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.

dobe’s picture

Is your theme overriding your panels-panel.tpl.php?

michelle’s picture

No, there is nothing custom on the site except whatever patch(es) I am currently testing and the associated contrib modules.

damienmckenna’s picture

Status: Needs review » Needs work

@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.

dobe’s picture

Oh weird my code has the preprocessor value. Ill get a patch re-rolled.

damienmckenna’s picture

@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.

dobe’s picture

@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.

mrjmd’s picture

StatusFileSize
new2.32 KB

@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.

mrjmd’s picture

Status: Needs work » Needs review
michelle’s picture

Status: Needs review » Reviewed & tested by the community

I 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. :)

dobe’s picture

Right on, good call. RTBC I suppose.

japerry’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new4.7 KB

One 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.

  • japerry committed c1fae46 on 7.x-1.x authored by dobe
    Issue #2288741 by dobe, mrjmd, japerry: Title Headings
    
japerry’s picture

Status: Needs review » Fixed

After 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.

dobe’s picture

Awesome! Funny, a patch I figured was least likely to ever get in, got in. Another testament that you should always upload your work.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

gmclelland’s picture

So 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 h3 but it didn't change anything.

gmclelland’s picture

I also tried adding $conf['override_title_heading'] = 'h3'; to my settings.php but it didn’t seem to work

gmclelland’s picture

For those interested, here is a follow up issue #2488280: Can't override the default Pane title heading tag with a patch.

japerry’s picture

Status: Closed (fixed) » Needs work

Re-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.

  • japerry committed cd9b814 on 7.x-1.x
    Issue #2288741 by japerry: Add title headings for custom content.
    
gmclelland’s picture

@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.

  • japerry committed a48f154 on 7.x-1.x
    Issue #2288741 by japerry: Add title headings for ctools custom content...
gmclelland’s picture

@japerry - The latest dev fixes the Notice: Undefined property errors I was seeing.

japerry’s picture

Status: Needs work » Closed (outdated)

Drupal 7 is no longer supported, closing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.