function page_manager_page_execute
Execute a page task.
This is the callback to entries in the Drupal menu system created by the page task.
Parameters
$subtask_id: The name of the page task used.
...: A number of context objects as specified by the user when creating named arguments in the path.
2 string references to 'page_manager_page_execute'
- page_manager_page_form_basic_validate in page_manager/
plugins/ tasks/ page.admin.inc - Validate the basic form.
- page_manager_page_menu_item in page_manager/
plugins/ tasks/ page.admin.inc - Create a menu item for page manager pages.
File
-
page_manager/
plugins/ tasks/ page.inc, line 263
Code
function page_manager_page_execute($subtask_id) {
$func_args = func_get_args();
$page = page_manager_page_load($subtask_id);
$task = page_manager_get_task($page->task);
$subtask = page_manager_get_task_subtask($task, $subtask_id);
// Turn the contexts into a properly keyed array.
$contexts = array();
$args = array();
foreach ($func_args as $count => $arg) {
if (is_object($arg) && get_class($arg) == 'ctools_context') {
$contexts[$arg->id] = $arg;
$args[] = $arg->original_argument;
}
elseif ($count) {
$args[] = $arg;
}
}
$count = 0;
$names = page_manager_page_get_named_arguments($page->path);
$bits = explode('/', $page->path);
if ($page->arguments) {
foreach ($page->arguments as $name => $argument) {
// Optional arguments must be converted to contexts too, if they exist.
if ($bits[$names[$name]][0] == '!') {
ctools_include('context');
$argument['keyword'] = $name;
if (isset($args[$count])) {
// Hack: use a special argument config variable to learn if we need
// to use menu_tail style behavior:
if (empty($argument['settings']['use_tail'])) {
$value = $args[$count];
}
else {
$value = implode('/', array_slice($args, $count));
}
$context = ctools_context_get_context_from_argument($argument, $value);
}
else {
// Make sure there is a placeholder context for missing optional contexts.
$context = ctools_context_get_context_from_argument($argument, NULL, TRUE);
// Force the title to blank for replacements.
}
if ($context) {
$contexts[$context->id] = $context;
}
}
$count++;
}
}
if ($function = ctools_plugin_get_function($task, 'page callback')) {
return call_user_func_array($function, array(
$page,
$contexts,
$args,
));
}
ctools_include('context-task-handler');
$output = ctools_context_handler_render($task, $subtask, $contexts, $args);
if ($output === FALSE) {
return MENU_NOT_FOUND;
}
return $output;
}