You are here

function page_manager_page_argument_finish in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 page_manager/plugins/tasks/page.admin.inc \page_manager_page_argument_finish()

Callback generated when the add page process is finished.

1 string reference to 'page_manager_page_argument_finish'
page_manager_page_subtask_argument_ajax in page_manager/plugins/tasks/page.admin.inc
Ajax entry point to edit an item

File

page_manager/plugins/tasks/page.admin.inc, line 1031
Administrative functions for the page subtasks.

Code

function page_manager_page_argument_finish(&$form_state) {

  // Check to see if there are changes.
  $page =& $form_state['page']->subtask['subtask'];
  $keyword =& $form_state['keyword'];
  if (isset($page->temporary_arguments[$keyword])) {
    $page->arguments[$keyword] = $page->temporary_arguments[$keyword];
  }
  if (isset($page->temporary_arguments)) {
    unset($page->temporary_arguments);
  }

  // Update the cache with changes.
  page_manager_set_page_cache($form_state['page']);

  // Rerender the table so we can ajax it back in.
  // Go directly to the form and retrieve it using a blank form and
  // a clone of our current form state. This is an abbreviated
  // drupal_get_form that is halted prior to render and is never
  // fully processed, but is guaranteed to produce the same form we
  // started with so we don't have to do crazy stuff to rerender
  // just part of it.
  // @todo should there be a tool to do this?
  $clone_state = $form_state;
  $clone_state['allow temp'] = TRUE;
  $form = array();
  page_manager_page_form_argument($form, $clone_state);
  drupal_prepare_form('page_manager_page_form_argument', $form, $clone_state);
  $form['#post'] = array();
  $form = form_builder('page_manager_page_form_argument', $form, $clone_state);

  // Render just the table portion.
  $output = drupal_render($form['table']);
  $form_state['commands'][] = ctools_ajax_command_replace('#page-manager-argument-table', $output);
}