You are here

function panels_argument_load_contexts in Panels 5.2

Same name and namespace in other branches
  1. 6.2 includes/plugins.inc \panels_argument_load_contexts()

Load the contexts for a given panel.

Parameters

$arguments: The array of argument definitions

&$contexts: The array of existing contexts.

$args: The arguments to load

Return value

FALSE if an argument wants to 404.

1 call to panels_argument_load_contexts()
panels_page_view_page in panels_page/panels_page.module
Page callback to view a panel page.

File

includes/plugins.inc, line 811
plugins.inc

Code

function panels_argument_load_contexts($arguments, &$contexts, $args) {
  foreach ($arguments as $argument) {

    // pull the argument off the list.
    $arg = array_shift($args);
    $id = panels_argument_context_id($argument);

    // For % arguments embedded in the URL, our context is already loaded.
    // There is no need to go and load it again.
    if (empty($contexts[$id])) {
      if ($context = panels_argument_get_context($argument, $arg)) {
        $contexts[$id] = $context;
      }
    }
    else {
      $context = $contexts[$id];
    }
    if ((empty($context) || empty($context->data)) && $argument['default'] == '404') {
      return FALSE;
    }
  }
  return TRUE;
}