function rules_admin_reaction_overview

Reaction rules overview.

2 string references to 'rules_admin_reaction_overview'
rules_admin_form_alter in rules_admin/rules_admin.module
Implements hook_form_alter().
rules_admin_menu in rules_admin/rules_admin.module
Implements hook_menu().

File

rules_admin/rules_admin.inc, line 11

Code

function rules_admin_reaction_overview($form, &$form_state, $base_path) {
    RulesPluginUI::formDefaults($form, $form_state);
    $conditions = array(
        'plugin' => 'reaction rule',
        'active' => TRUE,
    );
    $collapsed = TRUE;
    if (empty($_GET['tag'])) {
        $tag = 0;
    }
    else {
        $tag = $_GET['tag'];
        $conditions['tags'] = array(
            $tag,
        );
        $collapsed = FALSE;
    }
    if (empty($_GET['event'])) {
        $event = 0;
    }
    else {
        $event = $_GET['event'];
        // Filter using a wildcard suffix so configured event names with suffixes
        // are found also.
        $conditions['event'] = $event . '%';
        $collapsed = FALSE;
    }
    $form['help'] = array(
        '#markup' => t('Reaction rules, listed below, react on selected events on the site. Each reaction rule may fire any number of <em>actions</em>, and may have any number of <em>conditions</em> that must be met for the actions to be executed. You can also set up <a href="@url1">components</a> – stand-alone sets of Rules configuration that can be used in Rules and other parts of your site. See <a href="@url2">the online documentation</a> for an introduction on how to use Rules.', array(
            '@url1' => url('admin/config/workflow/rules/components'),
            '@url2' => rules_external_help('rules'),
        )),
    );
    $form['filter'] = array(
        '#type' => 'fieldset',
        '#title' => t('Filter'),
        '#collapsible' => TRUE,
    );
    $form['filter']['#id'] = 'rules-filter-form';
    $form['filter']['#attached']['css'][] = drupal_get_path('module', 'rules') . '/ui/rules.ui.css';
    $form['filter']['event'] = array(
        '#type' => 'select',
        '#title' => t('Filter by event'),
        '#options' => array(
            0 => t('<All>'),
        ) + RulesPluginUI::getOptions('event'),
        '#default_value' => $event,
    );
    $form['filter']['tag'] = array(
        '#type' => 'select',
        '#title' => t('Filter by tag'),
        '#options' => array(
            0 => t('<All>'),
        ) + RulesPluginUI::getTags(),
        '#default_value' => $tag,
    );
    $form['filter']['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Filter'),
        '#name' => '',
    );
    $options = array(
        'show plugin' => FALSE,
        'base path' => $base_path,
    );
    $form['active'] = rules_ui()->overviewTable($conditions, $options);
    $form['active']['#caption'] = t('Active rules');
    $form['active']['#empty'] = t('There are no active rules. <a href="!url">Add new rule</a>.', array(
        '!url' => url('admin/config/workflow/rules/reaction/add'),
    ));
    $conditions['active'] = FALSE;
    $form['inactive'] = rules_ui()->overviewTable($conditions, $options);
    $form['inactive']['#caption'] = t('Inactive rules');
    $form['inactive']['#empty'] = t('There are no inactive rules.');
    $form['filter']['#collapsed'] = $collapsed;
    $form['#submit'][] = 'rules_form_submit_rebuild';
    $form['#method'] = 'get';
    return $form;
}