You are here

function rules_admin_form_rule_set_settings in Rules 6

Returns the form for the settings of a rule set

2 calls to rules_admin_form_rule_set_settings()
rules_admin_form_add_rule_set in rules_admin/rules_admin.sets.inc
Form for adding a rule set
rules_admin_form_edit_rule_set in rules_admin/rules_admin.sets.inc
Shows the rule set edit page form

File

rules_admin/rules_admin.sets.inc, line 141

Code

function rules_admin_form_rule_set_settings($set_info = array(), $changable_name = TRUE) {
  $form['settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Rule set settings'),
    '#collapsible' => TRUE,
  );
  $form['settings']['label'] = array(
    '#title' => t('Label'),
    '#type' => 'textfield',
    '#description' => t('Choose an appropriate label for this rule set.'),
    '#default_value' => isset($set_info['label']) ? $set_info['label'] : '',
    '#required' => TRUE,
  );
  $form['settings']['name'] = array(
    '#title' => t('Machine readable name'),
    '#type' => 'textfield',
    '#description' => t('Specify a unique name containing only alphanumeric characters, and underscores.'),
    '#default_value' => isset($set_info['name']) ? $set_info['name'] : '',
    '#disabled' => !$changable_name,
    '#required' => TRUE,
  );

  // Only set the value if name isn't changable.
  if (!$changable_name) {
    $form['settings']['name']['#value'] = isset($set_info['name']) ? $set_info['name'] : '';
  }
  $form['settings']['categories'] = array(
    '#type' => 'textfield',
    '#title' => t('Categories'),
    '#default_value' => isset($set_info['categories']) ? implode(', ', $set_info['categories']) : '',
    '#description' => t('A comma-separated list of terms describing this rule set. Example: funny, bungee jumping.'),
    '#autocomplete_path' => RULES_ADMIN_PATH . '/autocomplete',
  );
  $form['settings']['button'] = array(
    '#type' => 'submit',
    '#weight' => 10,
    '#value' => t('Save changes'),
  );
  return $form;
}