function page_manager_edit_page_operation in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 page_manager/page_manager.admin.inc \page_manager_edit_page_operation()
Entry point to edit a single operation for a page.
Parameters
$js: Whether or not the page was called via javascript.
$page: The cached page that is being edited.
...: A number of items used to drill down into the actual operation called.
1 string reference to 'page_manager_edit_page_operation'
- page_manager_menu in page_manager/
page_manager.module - Delegated implementation of hook_menu().
File
- page_manager/
page_manager.admin.inc, line 438 - Administrative functions for the page manager.
Code
function page_manager_edit_page_operation() {
$args = func_get_args();
$js = array_shift($args);
$page = array_shift($args);
$operations = page_manager_get_operations($page);
$content = page_manager_get_operation_content($js, $page, $args, $operations);
// If the operation requested we go somewhere else afterward, oblige it.
if (isset($content['new trail'])) {
$args = $content['new trail'];
// Get operations again, for the operation may have changed their availability.
$operations = page_manager_get_operations($page);
$content = page_manager_get_operation_content($js, $page, $args, $operations);
}
// Rendering the content may have been a form submission that changed the
// operations, such as renaming or adding a handler. Thus we get a new set
// of operations.
$operations = page_manager_get_operations($page);
$rendered_operations = page_manager_render_operations($page, $operations, $args, array(
'class' => array(
'operations-main',
),
), 'nav');
// Since this form should never be submitted to this page, process it late so
// that we can be sure it notices changes.
$form_state = array(
'page' => &$page,
);
$built_form = drupal_build_form('page_manager_save_page_form', $form_state);
$form = drupal_render($built_form);
$output = theme('page_manager_edit_page', array(
'page' => $page,
'save' => $form,
'operations' => $rendered_operations,
'content' => $content,
));
if ($js) {
$commands = array();
$commands[] = ajax_command_replace('#page-manager-edit', $output);
print ajax_render($commands);
ajax_footer();
return;
}
drupal_set_title($page->subtask['admin title'], PASS_THROUGH);
return $output;
}