You are here

function nodejs_subscribe_send_notification in Node.js integration 7

Same name and namespace in other branches
  1. 6 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:

3 calls to nodejs_subscribe_send_notification()
nodejs_subscribe_comment_insert in nodejs_subscribe/nodejs_subscribe.module
Implements hook_comment_insert().
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 272

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(
    'channel' => 'nodejs_subscribe_node_' . $node->nid,
    'data' => (object) array(
      'subject' => $subject,
      'body' => $body,
    ),
  );
  nodejs_enqueue_message($message);
}