Browsing the source I found this in CTools:
/**
* A theme preprocess function to automatically allow panels-based node
* templates based upon input when the panel was configured.
*/
function ctools_preprocess_node(&$vars) {
// The 'panel_identifier' attribute of the node is added when the pane is
// rendered.
if (!empty($vars['node']->panel_identifier)) {
$vars['panel_identifier'] = check_plain($vars['node']->panel_identifier);
$vars['template_files'][] = 'node-panel-' . check_plain($vars['node']->panel
_identifier);
}
}
As content_types aren't limited to Panels any more, it would be nice if it could be generalised. I figure it's not possible for the content type to find out what is using the content type, so node-panel-id and node-dashboard-id is probably out of the question.
I was looking at the code because I'm looking into porting a Panels 2 pane module to Panels 3 which in essence does the same as the node content type, but allows for more specialized theming. I'm hoping to make it follow the Panels 3/CTools way more, so it could be useful as a contrib module (at the moment is a bit of a oddity, if a well functioning oddity).
Comments
Comment #1
merlinofchaos commentedAh, hm. I'm not quite sure what the best way to do this is. You're right, the content types don't have a really good way to know what the larger context they're operating in is, though.
Comment #2
merlinofchaos commentedI agree this could use further work. After looking at it some more, though, I'm not quite sure what to do. This requires some thinking and perhaps some discussion. I am open to ideas.
Comment #3
esmerel commentedThis has been postponed for two years. I'm marking it active because it either needs to become a task (maybe) or it's been rearchitected in some fashion (because there's been tons of changes), or it simply isn't worth pursuing at this point, and neither merlinofchaos or sdboyer are going to take that second look if it's in postponed.
Comment #4
xen commentedWell the current code works the same but names it "ctools_template_identifier". Though the temlate file is named "'node__panel__' . check_plain($vars['node']->ctools_template_identifier);"
It could be named node__ctools__*, but node__panel__* would be what the themers look for.