function panelizer_panelizer_task_get_addressable in Panelizer 7.3
Same name and namespace in other branches
- 7.2 plugins/task_handlers/panelizer_node.inc \panelizer_panelizer_task_get_addressable()
1 string reference to 'panelizer_panelizer_task_get_addressable'
- panelizer_node.inc in plugins/
task_handlers/ panelizer_node.inc - This is the task handler plugin to handle an entity view. NOTE: This is named panelizer_node for historical reasons. It is too much of a pain to change the name of a task handler. This panelizes any entity not just a node.
File
- plugins/
task_handlers/ panelizer_node.inc, line 357 - This is the task handler plugin to handle an entity view. NOTE: This is named panelizer_node for historical reasons. It is too much of a pain to change the name of a task handler. This panelizes any entity not just a node.
Code
function panelizer_panelizer_task_get_addressable($task, $subtask_name, $handler, $address, $contexts, $arguments, $type) {
ctools_include('plugins', 'panels');
if (empty($contexts)) {
return;
}
$context = _panelizer_panelizer_task_get_context($handler, $contexts);
if (empty($context->data)) {
return;
}
// Extract the entity from the context so we can load the panelizer.
$entity =& $context->data;
if (empty($entity->panelizer['page_manager']) || empty($entity->panelizer['page_manager']->display)) {
return;
}
// Load the panelizer info.
$panelizer = $entity->panelizer['page_manager'];
// Load the display.
$display = $panelizer->display;
// One of these two will always be set.
$entity_type = !empty($panelizer->entity_type) ? $panelizer->entity_type : $panelizer->panelizer_type;
$handler = panelizer_entity_plugin_get_handler($entity_type);
if (!$handler) {
return;
}
list($entity_id, $revision_id, $bundle) = entity_extract_ids($entity_type, $entity);
$display->context = $handler
->get_contexts($panelizer, $entity);
$display->args = $arguments;
$display->css_id = $panelizer->css_id;
$display->cache_key = implode(':', array(
'panelizer',
$entity_type,
$entity_id,
));
$renderer = panels_get_renderer($panelizer->pipeline, $display);
$renderer
->prepare();
$pid = array_shift($address);
if (!empty($renderer->prepared['panes'][$pid])) {
if ($type == 'content') {
return $renderer
->render_pane($renderer->prepared['panes'][$pid]);
}
elseif ($type == 'pane') {
return $renderer->prepared['panes'][$pid];
}
}
}