You are here

function views_autorefresh_nodejs_refresh in Views Auto-Refresh 7

Same name and namespace in other branches
  1. 7.2 views_autorefresh.module \views_autorefresh_nodejs_refresh()

Helper function to refresh a view through nodejs.

1 call to views_autorefresh_nodejs_refresh()
views_autorefresh_rules_process in ./views_autorefresh.rules.inc
Rules action function to process and send message to nodejs.

File

./views_autorefresh.module, line 230

Code

function views_autorefresh_nodejs_refresh($views, $context) {
  if (module_exists('nodejs') && function_exists('nodejs_send_content_channel_message')) {
    if ($views) {
      foreach ($views as $view_name) {
        $message = (object) array(
          'channel' => 'views_autorefresh_' . $view_name,
          'callback' => 'viewsAutoRefresh',
          'view_name' => $view_name,
        );
        drupal_alter('views_autorefresh_nodejs_message', $message, $context);
        nodejs_send_content_channel_message($message);
      }
    }
  }
}