You are here

function panels_panel_context_get_addressable in Panels 7.3

1 string reference to 'panels_panel_context_get_addressable'
panel_context.inc in plugins/task_handlers/panel_context.inc
This is the task handler plugin to handle attaching a panel to any task that advertises itself as a 'context' type, which all of the basic page tasks provided by page_manager.module do by default.

File

plugins/task_handlers/panel_context.inc, line 911
This is the task handler plugin to handle attaching a panel to any task that advertises itself as a 'context' type, which all of the basic page tasks provided by page_manager.module do by default.

Code

function panels_panel_context_get_addressable($task, $subtask_name, $handler, $address, $contexts, $arguments, $type) {

  // Load the display.
  $display = panels_panel_context_get_display($handler);
  $display->context = $contexts;
  $display->args = $arguments;
  $display->css_id = $handler->conf['css_id'];
  $display->cache_key = panels_panel_context_cache_key($task->name, $handler->name, $arguments);
  $renderer = panels_get_renderer($handler->conf['pipeline'], $display);
  $renderer
    ->prepare();
  if ($address) {
    $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];
      }
    }
  }
  else {
    if ($type == 'content') {
      return $renderer
        ->render();
    }
    elseif ($type == 'renderer') {
      return $renderer;
    }
  }
}