You are here

function _panelizer_panelizer_task_get_context in Panelizer 7.3

Same name and namespace in other branches
  1. 7.2 plugins/task_handlers/panelizer_node.inc \_panelizer_panelizer_task_get_context()

Figure out the correct context to use for this panelizer.

4 calls to _panelizer_panelizer_task_get_context()
panelizer_panelizer_task_contextual_link in plugins/task_handlers/panelizer_node.inc
Provide appropriate contextual links for Panelizer controlled entities.
panelizer_panelizer_task_get_addressable in plugins/task_handlers/panelizer_node.inc
panelizer_panelizer_task_render in plugins/task_handlers/panelizer_node.inc
Render a entity that has been panelized.
panelizer_panelizer_task_test in plugins/task_handlers/panelizer_node.inc
Determine if the panelizer task handler should fire.

File

plugins/task_handlers/panelizer_node.inc, line 84
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_context($handler, $contexts) {
  $contexts = ctools_context_handler_get_handler_contexts($contexts, $handler);
  if (isset($handler->conf['context']) && is_string($handler->conf['context']) && !empty($contexts[$handler->conf['context']])) {
    return $contexts[$handler->conf['context']];
  }

  // If one was not set up, we could be using old, saved data. Assume that
  // this means we just want the first context available.
  if (!empty($contexts)) {
    return reset($contexts);
  }

  // Fail!
  return new stdClass();
}