function path_breadcrumbs_get_contexts_from_arguments in Path Breadcrumbs 7.3
Same name and namespace in other branches
- 7.2 path_breadcrumbs.module \path_breadcrumbs_get_contexts_from_arguments()
Load ctools contexts from path arguments.
Parameters
$arguments: URL arguments.
bool $empty: Define load context for empty arguments or not
string $path: Page url.
Return value
array Array with context plugins.
3 calls to path_breadcrumbs_get_contexts_from_arguments()
- path_breadcrumbs_ctools_access_get in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - Callback for access control ajax form on behalf of context task handler (third step). Returns the cached access config and contexts used.
- path_breadcrumbs_load_variant in ./
path_breadcrumbs.module - Load and build path breadcrumb variant for page url. Results are cached.
- _path_breadcrumbs_ui_form_step_selection_rules in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - THIRD STEP. Provide form with selection rules.
File
- ./
path_breadcrumbs.module, line 725
Code
function path_breadcrumbs_get_contexts_from_arguments($arguments, $empty = FALSE, $path = NULL) {
$contexts = array();
// Include ctools library for contexts.
ctools_include('context');
if (!empty($arguments)) {
// Get contexts from arguments.
foreach ($arguments as $keyword => $arg) {
if (!empty($arg['argument'])) {
$argument = ctools_get_argument($arg['argument']);
if (isset($arg['settings'])) {
$argument = array_merge($argument, $arg['settings']);
}
// See what we should return: empty contexts or from path arguments.
$arg = $empty ? NULL : arg($arg['position'], $path);
// Build context.
$context = call_user_func($argument['context'], $arg, $argument, $empty);
if (!empty($context)) {
$context->keyword = $keyword;
$context->identifier = $argument['identifier'];
$contexts[$keyword] = $context;
// Override Ctools User plugin with improved PB version.
if ($context->plugin == 'user') {
$context->plugin = 'path_breadcrumbs_user';
}
}
else {
$contexts['broken_context'] = $keyword;
}
}
}
}
return $contexts;
}