You are here

function panels_pane_select_context in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/plugins.inc \panels_pane_select_context()
  2. 6.3 panels.module \panels_pane_select_context()

Select a context for a pane.

Parameters

$pane: A fully populated pane.

$contexts: A keyed array of available contexts.

Return value

The matching contexts or NULL if none or necessary, or FALSE if requirements can't be met.

2 calls to panels_pane_select_context()
panels_get_pane_title in includes/plugins.inc
Get the title of a pane.
panels_render_pane_content in includes/display-render.inc
Render a single pane, identifying its context, and put it into the $panes array.

File

includes/plugins.inc, line 1247
plugins.inc

Code

function panels_pane_select_context($pane, $contexts) {

  // Identify which of our possible contexts apply.
  if (empty($pane->subtype)) {
    return;
  }
  $content_type = panels_ct_get_types($pane->type);

  // If the pane requires a context, fetch it; if no context is returned,
  // do not display the pane.
  if (empty($content_type[$pane->subtype]['required context'])) {
    return;
  }
  $context = panels_context_select($contexts, $content_type[$pane->subtype]['required context'], $pane->configuration['context']);
  return $context;
}