You are here

function hook_views_autorefresh_nodejs_message_alter in Views Auto-Refresh 7

Same name and namespace in other branches
  1. 7.2 views_autorefresh.api.php \hook_views_autorefresh_nodejs_message_alter()

Alter the node.js message that gets sent to a view.

Parameters

Object &$message: A node.js message consisting of:

  • channel: the channel name
  • callback: the JavaScript node.js callback
  • view_name: the name of the view being notified

Mixed $context: Any additional context that the caller cares to send to allow the message altering hook to perform its logic.

1 invocation of hook_views_autorefresh_nodejs_message_alter()
views_autorefresh_nodejs_refresh in ./views_autorefresh.module
Helper function to refresh a view through nodejs.

File

./views_autorefresh.api.php, line 37
API documentation for the Views Auto-Refresh module.

Code

function hook_views_autorefresh_nodejs_message_alter(&$message, $context) {
  $nid = is_object($context) && isset($context->nid) ? $context->nid : '';
  if ($nid && $message->view_name == 'story_activity-page_1') {
    $message->channel .= '-' . $nid;
  }
}