function rules_admin_add_reaction_rule

Add reaction rules form.

1 string reference to 'rules_admin_add_reaction_rule'
rules_admin_menu in rules_admin/rules_admin.module
Implements hook_menu().

File

rules_admin/rules_admin.inc, line 312

Code

function rules_admin_add_reaction_rule($form, &$form_state, $base_path) {
    RulesPluginUI::formDefaults($form, $form_state);
    $rules_config = isset($form_state['rules_config']) ? $form_state['rules_config'] : rules_reaction_rule();
    $rules_config->form($form, $form_state, array(
        'show settings' => TRUE,
        'button' => TRUE,
    ));
    $form['settings']['#collapsible'] = FALSE;
    $form['settings']['#type'] = 'container';
    $form['settings']['label']['#default_value'] = '';
    // Hide the rule elements stuff for now.
    foreach (array(
        'elements',
        'conditions',
        'add',
        'events',
    ) as $key) {
        $form[$key]['#access'] = FALSE;
    }
    foreach (array(
        'active',
        'weight',
    ) as $key) {
        $form['settings'][$key]['#access'] = FALSE;
    }
    // Incorporate the form to add the first event.
    $form['settings'] += rules_ui_add_event(array(), $form_state, $rules_config, $base_path);
    $form['settings']['event']['#tree'] = FALSE;
    $form['settings']['event_settings']['#tree'] = FALSE;
    unset($form['settings']['help']);
    unset($form['settings']['submit']);
    $form['submit']['#value'] = t('Save');
    $form_state += array(
        'rules_config' => $rules_config,
    );
    $form['#validate'][] = 'rules_ui_add_reaction_rule_validate';
    $form['#validate'][] = 'rules_ui_edit_element_validate';
    $form['#submit'][] = 'rules_ui_add_reaction_rule_submit';
    return $form;
}