You are here

function page_manager_http_response_edit_settings in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 page_manager/plugins/task_handlers/http_response.inc \page_manager_http_response_edit_settings()

General settings for the panel.

1 string reference to 'page_manager_http_response_edit_settings'
http_response.inc in page_manager/plugins/task_handlers/http_response.inc
This is the task handler plugin to handle generating 403, 404, 301 and 302 response codes.

File

page_manager/plugins/task_handlers/http_response.inc, line 219
This is the task handler plugin to handle generating 403, 404, 301 and 302 response codes.

Code

function page_manager_http_response_edit_settings($form, &$form_state) {
  ctools_include('page_manager.admin', 'page_manager', '');
  ctools_include('export', 'ctools');
  $conf = $form_state['handler']->conf;
  $form['title'] = array(
    '#type' => 'textfield',
    '#default_value' => $conf['title'],
    '#title' => t('Administrative title'),
    '#description' => t('Administrative title of this variant.'),
  );
  $name = isset($conf['name']) ? $conf['name'] : FALSE;
  $form['name'] = array(
    '#type' => 'machine_name',
    '#title' => t('Machine name'),
    '#required' => FALSE,
    '#default_value' => $name,
    '#description' => t("A unique machine-readable name for this variant. It must only contain lowercase letters, numbers, and underscores. This name will be used when exporting the variant. If left empty the variant's name will be used instead."),
    '#size' => 32,
    '#maxlength' => 32,
    '#machine_name' => array(
      'exists' => 'page_manager_handler_check_machine_name',
      'source' => array(
        'title',
      ),
    ),
    '#field_prefix' => '<span dir="ltr">' . $form_state['task_name'] . '__',
    '#field_suffix' => '</span>&lrm;',
  );
  $form['code'] = array(
    '#title' => t('Response code'),
    '#type' => 'select',
    '#options' => page_manager_http_response_codes(),
    '#default_value' => $conf['code'],
  );
  ctools_include('dependent');
  $form['destination'] = array(
    '#type' => 'textfield',
    '#title' => t('Redirect destination'),
    '#default_value' => $conf['destination'],
    '#dependency' => array(
      'edit-code' => array(
        301,
        302,
      ),
    ),
    '#description' => t('Enter the path to redirect to. You may use keyword substitutions from contexts. You can use external urls (http://www.example.com/foo) or internal urls (node/1).'),
  );
  return $form;
}