function ctools_context_get_context_from_arguments in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 includes/context.inc \ctools_context_get_context_from_arguments()
Load the contexts for a given list of arguments.
Parameters
array $arguments: The array of argument definitions.
array &$contexts: The array of existing contexts. New contexts will be added to this array.
array $args: The arguments to load.
Return value
bool TRUE if all is well, FALSE if an argument wants to 404.
See also
ctools_context_get_context_from_argument()
1 call to ctools_context_get_context_from_arguments()
- ctools_context_handler_get_task_contexts in includes/
context-task-handler.inc - Load the contexts for a task, using arguments.
File
- includes/
context.inc, line 1246 - Contains code related to the ctools system of 'context'.
Code
function ctools_context_get_context_from_arguments($arguments, &$contexts, $args) {
foreach ($arguments as $argument) {
// Pull the argument off the list.
$arg = array_shift($args);
$id = ctools_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 = ctools_context_get_context_from_argument($argument, $arg)) {
$contexts[$id] = $context;
}
}
else {
$context = $contexts[$id];
}
if ((empty($context) || empty($context->data)) && !empty($argument['default']) && $argument['default'] === '404') {
return FALSE;
}
}
return TRUE;
}