You are here

function page_manager_page_argument_form_settings 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_form_settings()

Basic settings form for a page manager page.

1 string reference to 'page_manager_page_argument_form_settings'
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 1181
Administrative functions for the page subtasks.

Code

function page_manager_page_argument_form_settings(&$form, &$form_state) {
  $page =& $form_state['page']->subtask['subtask'];
  $keyword =& $form_state['keyword'];
  if (isset($page->temporary_arguments[$keyword])) {
    $conf = $page->temporary_arguments[$keyword];
  }
  else {
    if (isset($page->arguments[$keyword])) {
      $conf = $page->temporary_arguments[$keyword] = $page->arguments[$keyword];
    }
  }
  if (!isset($conf)) {

    // This should be impossible and thus never seen.
    $form['error'] = array(
      '#value' => t('Error: missing argument.'),
    );
    return;
  }
  ctools_include('context');
  $plugin = ctools_get_argument($conf['name']);
  $form['settings'] = array(
    '#tree' => TRUE,
  );
  $form['identifier'] = array(
    '#type' => 'textfield',
    '#title' => t('Context identifier'),
    '#description' => t('This is the title of the context used to identify it later in the administrative process. This will never be shown to a user.'),
    '#default_value' => $conf['identifier'],
  );
  if (!$plugin) {

    // This should be impossible and thus never seen.
    $form['error'] = array(
      '#value' => t('Error: missing or invalid argument plugin %argument.', array(
        '%argument',
        $argument,
      )),
    );
    return;
  }
  if ($function = ctools_plugin_get_function($plugin, 'settings form')) {
    $function($form, $form_state, $conf['settings']);
  }
  $form_state['plugin'] = $plugin;
}