You are here

public function Notifications_Event::trigger in Notifications 7

Same name and namespace in other branches
  1. 6.4 includes/notifications_event.class.inc \Notifications_Event::trigger()

Trigger event. Save, run queue query, etc...

Replaces notifications_event_trigger($event)

File

./notifications.event.inc, line 225
Drupal Notifications Framework - Default class file

Class

Notifications_Event
Notifications Event class

Code

public function trigger() {

  // If already been triggered, don't do it again
  if (empty($this->triggered)) {
    $this
      ->prepare();
    $this->triggered = REQUEST_TIME;

    // Notify other modules we are about to trigger some subscriptions event
    // Modules can do cleanup operations or modify event properties. To discard, set $event->dispatch = FALSE;
    $this
      ->invoke_all('trigger');

    // Now dispatch de event (send, queue) if not marked for the opposite
    if ($this->dispatch) {
      return $this
        ->dispatch();
    }
  }

  // If already triggered, or not to be dispatched or whatever
  return FALSE;
}