Posted by nafmarcus on May 24, 2012 at 10:04pm
4 followers
| Project: | Panels |
| Version: | 7.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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.
| Attachment | Size |
|---|---|
| pane theming suggestions.png | 26.78 KB |
Comments
#1
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.
#2
So for now, I should add my own template file name to the theme_hook_suggestions[] array? (& thanks for your time.)
#3
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.
#4
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.
#5
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
#6
Thanks a ton! Committed and pushed.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.