function panels_argument_load_contexts in Panels 6.2
Same name and namespace in other branches
- 5.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.
File
- includes/
plugins.inc, line 817  - 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_context_id($argument, '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;
}