I need to create a template file to theme a certain pane.
When i look at the theme_hook_suggestions, the 2nd suggestion would be perfect if I knew how to name the file. The suggestion is:

panels_pane__entity_field__node:field_overall_rating.

I got this far:
panel-pane--entity-field-[xxxx]tp.php

How do I finish the name?
Thanks.

Comments

merlinofchaos’s picture

Category: task » bug

That's a bug in our code that isn't translating the : to an _ for the suggestion. You probably can't actually create a : in a suggestion name.

nafmarcus’s picture

So for now, I should add my own template file name to the theme_hook_suggestions[] array? (& thanks for your time.)

merlinofchaos’s picture

Yes that's a good workaround.

If you're up for it, it should be a simple patch to preg_replace or maybe even ctools_cleanstring.

caschbre’s picture

I came across this issue as well. It looks like the patch from #1178334: Automatically detect panel pane template suggestions by pane type is using strtr on string that has not been cleansed.

// Add template file suggestion for content type and sub-type.
$vars['theme_hook_suggestions'][] = $base . $delimiter . $content->type;
$vars['theme_hook_suggestions'][] = $base . $delimiter . strtr($content->type, '-', '_') . $delimiter . strtr($content->subtype, '-', '_');

I'll see if I can create a patch for this.

caschbre’s picture

Version: 7.x-3.2 » 7.x-3.x-dev
Component: Panel nodes » Code
Status: Active » Needs review
StatusFileSize
new888 bytes

I've attached a patch that runs $content->type and $content->subtype through ctools_cleanstring before performing strtr. I looked at the new template suggestions and the colon is now replaced with a _.

What used to be:
panels_pane__entity_field__node:field_birthday

is now:
panels_pane__entity_field__node_field_birthday

merlinofchaos’s picture

Status: Needs review » Fixed

Thanks a ton! Committed and pushed.

Status: Fixed » Closed (fixed)

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

  • Commit 4b4d7f9 on 7.x-3.x, 7.x-3.x-i18n, 8.x-3.x by merlinofchaos:
    Issue #1599374 by caschbre: Use ctools cleanstring on panel template...