I am using Page Manager and Panels, providing custom node panels with selection rules by type (e.g. one panel variant for article-, one panel variant for blog-content type). This works smooth so far, styling is also neat. But, how can I get more power over the rendering of elements?
There are multiple ways to render specific elements: adding fields, using token, using a custom view only rendering specific fields, using rendered node entity with view mode. using custom panel content with placeholders etc.
What is the best approach here? It would be great to have the ability to add a custom (something) pane element that can be styled in a *.tpl.php.
My current approach would be using display suite, creating view modes for different parts / panel regions and using theme hook suggestions for adding custom node.tpl.php for each view mode. It would not need to invoke views, which is pretty much a overkill?! rendering, additional queries...) and can use already cached entities.
function mytheme_preprocess_node(&$vars) {
if ($vars['node']->type == 'my_content_type' && $vars['view_mode'] == 'panel_region_left') {
$vars['theme_hook_suggestions'][] = 'node__my_content_type__panel_region_left';
}
if ($vars['node']->type == 'my_content_type' && $vars['view_mode'] == 'panel_region_right') {
$vars['theme_hook_suggestions'][] = 'node__my_content_type__panel_region_right';
}
}
I am not sure how well this will be cached and how much resources it will consume. Any advice would be grateful.