You are here

function themekey_redirect_rule_chain_form in ThemeKey 7.3

Form builder for the rule chain.

The form will not be validated. All changes will be saved immediately. Validation will happen when the form displays the stored configuration. Otherwise all the drag'n'drop stuff will not work.

See also

themekey_form_alter()

themekey_rule_chain_form_submit()

themekey_rule_chain_form_set_error()

2 string references to 'themekey_redirect_rule_chain_form'
themekey_redirect_menu in themekey_redirect/themekey_redirect.module
Implements hook_menu().
themekey_redirect_themekey_page_cache_support_alter in themekey_redirect/themekey_redirect.module
Implements hook_themekey_page_cache_support_alter().

File

themekey_redirect/themekey_redirect_admin.inc, line 28

Code

function themekey_redirect_rule_chain_form($form, &$form_state) {
  $form = themekey_abstract_rule_chain_form($form, $form_state, array(
    'load_rules_callback' => 'themekey_redirect_load_rules',
    'themes' => themekey_redirect_options(),
    'rule_delete_path' => 'admin/config/user-interface/themekey/redirects/delete/',
  ));
  $items = themekey_redirect_load_rules();
  if (!empty($form['old_items'])) {
    foreach ($form['old_items'] as $id => &$old_item) {
      $old_item['theme']['#type'] = 'textfield';
      unset($old_item['theme']['#options']);
      $old_item['append_path'] = array(
        '#type' => 'checkbox',
        '#title' => t('append path'),
        '#default_value' => isset($items[$id]['append_path']) ? $items[$id]['append_path'] : TRUE,
      );
    }
  }
  $form['new_item']['theme']['#type'] = 'textfield';
  $form['new_item']['theme']['#default_value'] = 'http://';
  unset($form['new_item']['theme']['#options']);
  $form['new_item']['append_path'] = array(
    '#type' => 'checkbox',
    '#title' => t('append path'),
    '#default_value' => TRUE,
  );
  return $form;
}