You are here

function rules_invoke_event in Rules 7.2

Same name and namespace in other branches
  1. 6 rules/rules.module \rules_invoke_event()

Invokes configured rules for the given event.

Parameters

$event_name: The event's name.

...: Pass parameters for the variables provided by this event, as defined in hook_rules_event_info(). Example given:

rules_invoke_event('node_view', $node, $view_mode);

See also

rules_invoke_event_by_args()

11 calls to rules_invoke_event()
rules_cron in modules/events.inc
Implements hook_cron().
rules_entity_delete in modules/events.inc
Implements hook_entity_delete().
rules_entity_insert in modules/events.inc
Implements hook_entity_insert().
rules_entity_presave in modules/events.inc
Implements hook_entity_presave().
rules_entity_update in modules/events.inc
Implements hook_entity_update().

... See full list

File

./rules.module, line 1056
Rules engine module.

Code

function rules_invoke_event() {
  $args = func_get_args();
  $event_name = $args[0];
  unset($args[0]);

  // We maintain a whitelist of configured events to reduces the number of cache
  // reads. If the whitelist is not in the cache we proceed and it is rebuilt.
  if (rules_event_invocation_enabled()) {
    $whitelist = rules_get_cache('rules_event_whitelist');
    if (($whitelist === FALSE || isset($whitelist[$event_name])) && ($event = rules_get_cache('event_' . $event_name))) {
      $event
        ->executeByArgs($args);
    }
  }
}