function RulesReactionRule::event

Implements RulesTriggerableInterface::event().

Overrides RulesTriggerableInterface::event

File

includes/rules.plugins.inc, line 417

Class

RulesReactionRule
Represents rules getting triggered by events.

Code

public function event($event_name, array $settings = NULL) {
    // Process any settings and determine the configured event's name.
    if ($settings) {
        $handler = rules_get_event_handler($event_name, $settings);
        if ($suffix = $handler->getEventNameSuffix()) {
            $event_name .= '--' . $suffix;
            $this->eventSettings[$event_name] = $settings;
        }
        else {
            // Do not store settings if there is no suffix.
            unset($this->eventSettings[$event_name]);
        }
    }
    if (array_search($event_name, $this->events) === FALSE) {
        $this->events[] = $event_name;
    }
    return $this;
}