function _pm_arg_load

Load a context from an argument for a given page task.

Helper function for pm_arg_load(), which is in page_manager.module because drupal's menu system does not allow loader functions to reside in separate files.

Parameters

$value: The incoming argument value.

$subtask: The subtask id.

$argument: The numeric position of the argument in the path, counting from 0.

Return value

A context item if one is configured, the argument if one is not, or FALSE if restricted or invalid.

3 calls to _pm_arg_load()
pm_arg_load in page_manager/page_manager.module
Page manager arg load function because menu system will not load extra files for these; they must be in a .module.
pm_arg_tail_load in page_manager/page_manager.module
Special arg_load function to use %menu_tail like functionality to get everything after the arg together as a single value.
pm_uid_arg_load in page_manager/page_manager.module
Special menu _load() function for the user:uid argument.

File

page_manager/plugins/tasks/page.inc, line 532

Code

function _pm_arg_load($value, $subtask, $argument) {
    $page = page_manager_page_load($subtask);
    if (!$page) {
        return FALSE;
    }
    $path = explode('/', $page->path);
    if (empty($path[$argument])) {
        return FALSE;
    }
    $keyword = substr($path[$argument], 1);
    if (empty($page->arguments[$keyword])) {
        return $value;
    }
    $page->arguments[$keyword]['keyword'] = $keyword;
    ctools_include('context');
    $context = ctools_context_get_context_from_argument($page->arguments[$keyword], $value);
    // Convert false equivalents to false.
    return $context ? $context : FALSE;
}