You are here

function notifications_content_node_event in Notifications 7

Build node event. We can have 'node-[type]' or plain 'node' events

We keep track of the events in this request so we return the same event if tried again Events are not supossed to be triggered twice, see Notifications_Event::trigger()

File

notifications_content/notifications_content.module, line 525
Subscriptions to content events

Code

function notifications_content_node_event($action, $node) {
  $page =& drupal_static(__FUNCTION__);
  if (!isset($page[$action][$node->nid])) {
    if (notifications_event_type('node-' . $node->type . '-' . $action)) {
      $type = 'node-' . $node->type . '-' . $action;
    }
    else {
      $type = 'node-' . $action;
    }
    $page[$action][$node->nid] = notifications_event($type, $action)
      ->add_object('node', $node);
  }
  return $page[$action][$node->nid];
}