class RulesReactionRuleUI

Reaction rule specific UI.

Hierarchy

Expanded class hierarchy of RulesReactionRuleUI

1 string reference to 'RulesReactionRuleUI'
rules_rules_plugin_info in ./rules.module
Implements hook_rules_plugin_info().

File

ui/ui.plugins.inc, line 92

View source
class RulesReactionRuleUI extends RulesRuleUI {
    public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
        $form['events'] = array(
            '#type' => 'container',
            '#weight' => -10,
            '#access' => empty($options['init']),
        );
        $form['events']['table'] = array(
            '#theme' => 'table',
            '#caption' => 'Events',
            '#header' => array(
                t('Event'),
                t('Operations'),
            ),
            '#empty' => t('None'),
        );
        $form['events']['table']['#attributes']['class'][] = 'rules-elements-table';
        foreach ($this->rule
            ->events() as $event_name) {
            $event_handler = rules_get_event_handler($event_name, $this->rule
                ->getEventSettings($event_name));
            $event_operations = array(
                '#theme' => 'links__rules',
                '#attributes' => array(
                    'class' => array(
                        'rules-operations',
                        'action-links',
                        'rules_rule_event',
                    ),
                ),
                '#links' => array(
                    'delete_event' => array(
                        'title' => t('delete'),
                        'href' => RulesPluginUI::path($this->rule->name, 'delete/event/' . $event_name),
                        'query' => drupal_get_destination(),
                    ),
                ),
            );
            $form['events']['table']['#rows'][$event_name] = array(
                'data' => array(
                    $event_handler->summary(),
                    array(
                        'data' => $event_operations,
                    ),
                ),
            );
        }
        // Add the "add event" row.
        $cell['colspan'] = 3;
        $cell['data']['#theme'] = 'links__rules';
        $cell['data']['#attributes']['class'][] = 'rules-operations-add';
        $cell['data']['#attributes']['class'][] = 'action-links';
        $cell['data']['#links']['add_event'] = array(
            'title' => t('Add event'),
            'href' => RulesPluginUI::path($this->rule->name, 'add/event'),
            'query' => drupal_get_destination(),
        );
        $form['events']['table']['#rows'][] = array(
            'data' => array(
                $cell,
            ),
            'class' => array(
                'rules-elements-add',
            ),
        );
        parent::form($form, $form_state, $options);
        unset($form['label']);
    }
    
    /**
     * Adds the configuration settings form (label, tags, description, ..).
     */
    public function settingsForm(&$form, &$form_state) {
        parent::settingsForm($form, $form_state);
        $form['settings']['active'] = array(
            '#type' => 'checkbox',
            '#title' => t('Active'),
            '#default_value' => !isset($this->rule->active) || $this->rule->active,
        );
        $form['settings']['weight'] = array(
            '#type' => 'weight',
            '#title' => t('Weight'),
            '#default_value' => $this->element->weight,
            '#weight' => 5,
            '#delta' => 10,
            '#description' => t('Order rules that react on the same event. Rules with a higher weight are evaluated after rules with less weight.'),
        );
        unset($form['settings']['component_provides']);
    }
    public function settingsFormExtractValues($form, &$form_state) {
        $form_values = RulesPluginUI::getFormStateValues($form['settings'], $form_state);
        parent::settingsFormExtractValues($form, $form_state);
        $this->rule->active = $form_values['active'];
        $this->rule->weight = $form_values['weight'];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
RulesContainerPluginUI::addOperations public function Gets the Add-* operations for the given element.
RulesContainerPluginUI::buildContent public function Implements RulesPluginUIInterface. Overrides RulesPluginUI::buildContent 1
RulesPluginUI::$basePath public static property The base path determines where a Rules overview UI lives.
RulesPluginUI::$element protected property
RulesPluginUI::defaultRedirect public static function Determines the default redirect target for an edited/deleted element.
RulesPluginUI::formDefaults public static function
RulesPluginUI::form_submit public function Implements RulesPluginUIInterface. Overrides RulesPluginUIInterface::form_submit
RulesPluginUI::form_validate public function Implements RulesPluginUIInterface. Overrides RulesPluginUIInterface::form_validate 2
RulesPluginUI::getDataTypeClass public function Returns the name of class for the given data type.
RulesPluginUI::getFormStateValues public static function Returns the state values for $form, possibly only a part of the whole form.
RulesPluginUI::getOptions public static function
RulesPluginUI::getParameterForm protected function Actually generates the parameter form for the given data type.
RulesPluginUI::getTags public static function
RulesPluginUI::getVariableForm public function Returns the form for configuring the info of a single variable.
RulesPluginUI::help public function Implements RulesPluginUIInterface. Overrides RulesPluginUIInterface::help
RulesPluginUI::overviewTable public static function Deprecated by the controllers overviewTable() method.
RulesPluginUI::path public static function Generates an operation path.
RulesPluginUI::settingsFormPermissionMatrix protected function Provides a matrix permission for the component based in the existing roles.
RulesPluginUI::settingsFormSubmit public function
RulesPluginUI::settingsFormValidate public function
RulesReactionRuleUI::form public function Implements RulesPluginUIInterface::form(). Overrides RulesRuleUI::form
RulesReactionRuleUI::settingsForm public function Adds the configuration settings form (label, tags, description, ..). Overrides RulesPluginUI::settingsForm
RulesReactionRuleUI::settingsFormExtractValues public function Overrides RulesPluginUI::settingsFormExtractValues
RulesRuleUI::$conditions protected property
RulesRuleUI::$rule protected property
RulesRuleUI::form_extract_values public function Applies the values of the form to the rule configuration. Overrides RulesContainerPluginUI::form_extract_values
RulesRuleUI::operations public function Implements RulesPluginUIInterface. Overrides RulesContainerPluginUI::operations
RulesRuleUI::__construct public function Constructs a RulesRuleUI object. Overrides RulesPluginUI::__construct