You are here

function panelizer_panelizer_task_render in Panelizer 7.2

Same name and namespace in other branches
  1. 6 plugins/task_handlers/panelizer_node.inc \panelizer_panelizer_task_render()
  2. 7.3 plugins/task_handlers/panelizer_node.inc \panelizer_panelizer_task_render()
  3. 7 plugins/task_handlers/panelizer_node.inc \panelizer_panelizer_task_render()

Render a entity that has been panelized.

1 string reference to 'panelizer_panelizer_task_render'
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 221
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_render($handler, $base_contexts, $args, $test = TRUE) {

  // Get the context this is viewing; figure out what entity it is and load
  // the right plugin.
  ctools_include('context');
  $context = _panelizer_panelizer_task_get_context($handler, $base_contexts);
  if (!$context) {
    return FALSE;
  }
  if (empty($context->data->panelizer)) {
    return FALSE;
  }
  $panelizer = $context->data->panelizer;

  // One of these two will always be set.
  $entity_type = !empty($panelizer->entity_type) ? $panelizer->entity_type : $panelizer->panelizer_type;
  $address = implode('::', array(
    'page_manager',
    $handler->task,
    $handler->subtask,
    $handler->name,
    implode('..', $args),
  ));
  if ($entity_handler = panelizer_entity_plugin_get_handler($entity_type)) {
    $info = $entity_handler
      ->render_entity($context->data, $args, $address);
    $info['title'] = $panelizer->display
      ->get_title();
    return $info;
  }
}