function rules_admin_form_add_rule_set in Rules 6
Form for adding a rule set
1 string reference to 'rules_admin_form_add_rule_set'
- rules_admin_menu in rules_admin/
rules_admin.module - Implementation of hook_menu().
File
- rules_admin/
rules_admin.sets.inc, line 203
Code
function rules_admin_form_add_rule_set(&$form_state) {
//in case of non-js we degrade to a multistep form
$set_info = isset($form_state['set']) ? $form_state['set'] : array(
'arguments' => array(),
);
$form = rules_admin_form_rule_set_settings($set_info);
unset($form['settings']['button']);
//add form for specifying arguments
$form['args'] = array(
'#type' => 'fieldset',
'#title' => t('Arguments'),
'#collapsible' => TRUE,
'#prefix' => '<div id="rules-set-args">',
'#suffix' => '</div>',
'#tree' => TRUE,
'#theme' => 'rules_admin_form_arguments',
'#description' => t('You may specify some arguments, which have to be passed to the rule set when it is invoked. For each argument you have to specify a certain data type, a label and a unique machine readable name containing only alphanumeric characters, and underscores.'),
);
foreach ($set_info['arguments'] as $name => $info) {
$form['settings']['args'][$name] = _rules_admin_form_argument($name, $info);
}
for ($i = 0; $i < 3; $i++) {
$form['args'][$i] = _rules_admin_form_argument();
}
$form['args']['rules_more'] = array(
'#type' => 'submit',
'#value' => t('More arguments'),
'#description' => t("If the amount of boxes above isn't enough, click here to add more arguments."),
'#weight' => 1,
'#submit' => array(
'rules_admin_form_add_rule_set_rebuild',
),
// If no javascript action.
'#ahah' => array(
'path' => RULES_ADMIN_SET_PATH . '/js',
'wrapper' => 'rules-set-args',
'method' => 'replace',
),
);
$form['button'] = array(
'#type' => 'submit',
'#weight' => 10,
'#value' => t('Save'),
);
return $form;
}