You are here

function themekey_css_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()

1 string reference to 'themekey_css_rule_chain_form'
themekey_css_menu in themekey_css/themekey_css.module
Implements hook_menu().

File

themekey_css/themekey_css_admin.inc, line 28

Code

function themekey_css_rule_chain_form($form, &$form_state) {
  $css_group_options = array(
    'CSS_DEFAULT' => 'default',
    'CSS_THEME' => 'theme',
    'CSS_SYSTEM' => 'system',
  );

  // range(-50, 50) returns array with keys from 0 to 100
  // but we need array with keys from -50 to 50
  // because keys will be values for select.
  $css_weight_options = drupal_map_assoc(range(-50, 50));
  return themekey_abstract_rule_chain_form($form, $form_state, array(
    'load_rules_callback' => 'themekey_css_load_rules',
    'themes' => themekey_css_options(),
    'rule_delete_path' => 'admin/config/user-interface/themekey/css/delete/',
    'additional_fields' => array(
      'css_group' => array(
        '#type' => 'select',
        '#default_value' => 'CSS_DEFAULT',
        '#options' => $css_group_options,
      ),
      'css_weight' => array(
        '#type' => 'select',
        '#default_value' => 0,
        '#options' => $css_weight_options,
      ),
    ),
  ));
}