You are here

function nodejs_subscribe_send_notification in Node.js integration 6

Same name and namespace in other branches
  1. 7 nodejs_subscribe/nodejs_subscribe.module \nodejs_subscribe_send_notification()

Send a message that the given node was updated.

Parameters

mixed $node:

mixed $action:

array $link_options:

4 calls to nodejs_subscribe_send_notification()
nodejs_subscribe_comment_insert in nodejs_subscribe/nodejs_subscribe.module
Implements hook_comment_insert().
nodejs_subscribe_nodeapi in nodejs_subscribe/nodejs_subscribe.module
Implements hook_nodeapi().
nodejs_subscribe_node_delete in nodejs_subscribe/nodejs_subscribe.module
Implements hook_node_delete().
nodejs_subscribe_node_update in nodejs_subscribe/nodejs_subscribe.module
Implements hook_node_update().

File

nodejs_subscribe/nodejs_subscribe.module, line 361

Code

function nodejs_subscribe_send_notification($node, $action, $link_options = array()) {
  $subject = t('Node %action.', array(
    '%action' => $action,
  ));
  $link = l($node->title, 'node/' . $node->nid);
  $body = t('The node !link was %action.', array(
    '!link' => $link,
    '%action' => $action,
  ));
  $message = (object) array(
    'broadcast' => FALSE,
    'channel' => 'nodejs_subscribe_node_' . $node->nid,
    'data' => (object) array(
      'subject' => $subject,
      'body' => $body,
    ),
  );
  nodejs_enqueue_message($message);
}