function rules_get_event_handler

Returns the rule event handler for the given event.

Events having no settings are handled via the class RulesEventSettingsNone.

Parameters

string $event_name: The event name (base or configured).

array $settings: (optional) An array of event settings to set on the handler.

Return value

RulesEventHandlerInterface The event handler.

13 calls to rules_get_event_handler()
RulesEntityController::delete in includes/rules.core.inc
Overridden to also delete tags and events.
RulesEntityController::save in includes/rules.core.inc
RulesEventDispatcherTestCase::testStartAndStop in tests/rules.test
Tests start and stop functionality.
RulesEventDispatcherTestCase::testStartAndStopMultiple in tests/rules.test
Tests start and stop functionality when used with multiple events.
RulesEventSet::rebuildEventCache in includes/rules.plugins.inc
Rebuilds the event cache.

... See full list

File

./rules.module, line 710

Code

function rules_get_event_handler($event_name, array $settings = NULL) {
    $event_name = rules_get_event_base_name($event_name);
    $event_info = rules_get_event_info($event_name);
    $class = !empty($event_info['class']) ? $event_info['class'] : 'RulesEventDefaultHandler';
    $handler = new $class($event_name, $event_info);
    return isset($settings) ? $handler->setSettings($settings) : $handler;
}