You are here

function page_manager_page_subtask_argument_ajax 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_subtask_argument_ajax()

Ajax entry point to edit an item

1 string reference to 'page_manager_page_subtask_argument_ajax'
page_manager_page_menu in page_manager/plugins/tasks/page.admin.inc
Delegated implementation of hook_menu().

File

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

Code

function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL, $keyword = NULL) {
  ctools_include('ajax');
  ctools_include('modal');
  ctools_include('context');
  ctools_include('wizard');
  if (!$step) {
    return ctools_ajax_render_error();
  }
  if (!($cache = page_manager_get_page_cache($task_name))) {
    return ctools_ajax_render_error(t('Invalid object name.'));
  }
  $page =& $cache->subtask['subtask'];
  $path = $page->path;
  $arguments = page_manager_page_get_named_arguments($path);

  // Load stored object from cache.
  if (!isset($arguments[$keyword])) {
    return ctools_ajax_render_error(t('Invalid keyword.'));
  }

  // Set up wizard info
  $form_info = array(
    'id' => 'page_manager_page_argument',
    'path' => "admin/build/pages/argument/%step/{$task_name}/{$keyword}",
    'show cancel' => TRUE,
    'next callback' => 'page_manager_page_argument_next',
    'finish callback' => 'page_manager_page_argument_finish',
    'cancel callback' => 'page_manager_page_argument_cancel',
    'order' => array(
      'change' => t('Change context type'),
      'settings' => t('Argument settings'),
    ),
    'forms' => array(
      'change' => array(
        'title' => t('Change argument'),
        'form id' => 'page_manager_page_argument_form_change',
      ),
      'settings' => array(
        'title' => t('Argument settings'),
        'form id' => 'page_manager_page_argument_form_settings',
      ),
    ),
  );
  $form_state = array(
    'page' => $cache,
    'keyword' => $keyword,
    'ajax' => TRUE,
    'modal' => TRUE,
    'commands' => array(),
  );

  // With 'modal' and 'ajax' true, rendering automatically happens here so
  // we do nothing with the result.
  $output = ctools_wizard_multistep_form($form_info, $step, $form_state);
}