function rules_invoke_event_by_args
Invokes configured rules for the given event.
Parameters
string $event_name: The event's name.
array $args: An array of parameters for the variables provided by the event, as defined in hook_rules_event_info(). Either pass an array keyed by the variable names or a numerically indexed array, in which case the ordering of the passed parameters has to match the order of the specified variables. Example given:
rules_invoke_event_by_args('node_view', array(
'node' => $node,
'view_mode' => $view_mode,
));
See also
1 call to rules_invoke_event_by_args()
- rules_invoke_all in ./
rules.module - Invokes a hook and the associated rules event.
File
-
./
rules.module, line 1119
Code
function rules_invoke_event_by_args($event_name, $args = array()) {
// We maintain a whitelist of configured events to reduces the number of cache
// reads. If the whitelist is empty we proceed and it is rebuilt.
if (rules_event_invocation_enabled()) {
$whitelist = rules_get_cache('rules_event_whitelist');
if ((empty($whitelist) || isset($whitelist[$event_name])) && ($event = rules_get_cache('event_' . $event_name))) {
$event->executeByArgs($args);
}
}
}