function panels_get_renderer in Panels 7.3
Same name and namespace in other branches
- 6.3 includes/plugins.inc \panels_get_renderer()
Choose a renderer for a display based on a render pipeline setting.
3 calls to panels_get_renderer()
- panels_node_hook_view in panels_node/
panels_node.module - Implementation of hook_view().
- panels_panel_context_get_addressable in plugins/
task_handlers/ panel_context.inc - panels_panel_context_render in plugins/
task_handlers/ panel_context.inc - Check selection rules and, if passed, render the contexts.
File
- includes/
plugins.inc, line 414 - Contains helper code for plugins and contexts.
Code
function panels_get_renderer($pipeline_name, &$display) {
// Load the pipeline.
ctools_include('export');
$pipeline = ctools_export_crud_load('panels_renderer_pipeline', $pipeline_name);
// If we can't, or it has no renderers, default.
if (!$pipeline || empty($pipeline->settings['renderers'])) {
return panels_get_renderer_handler('standard', $display);
}
// Get contexts set on the pipeline:
$contexts = array();
if (!empty($pipeline->settings['contexts'])) {
$contexts = ctools_context_load_contexts($pipeline->settings['context']);
}
// Cycle through our renderers and see.
foreach ($pipeline->settings['renderers'] as $candidate) {
// See if this passes selection criteria.
if (!ctools_access($candidate['access'], $contexts)) {
continue;
}
$renderer = panels_get_renderer_handler($candidate['renderer'], $display);
if (!empty($candidate['options'])) {
$renderer
->set_options($candidate['options']);
}
return $renderer;
}
// Fall through. If no renderer is selected, use the standard renderer.
return panels_get_renderer_handler('standard', $display);
}