You are here

function rotor_views_post_render in Rotor Banner 7

Same name and namespace in other branches
  1. 6.2 rotor.module \rotor_views_post_render()

Implementation of hook_views_post_render().

Override the rotor view to inject javascript.

Parameters

view Which view we are using.:

Return value

unknown as of yet.

File

./rotor.module, line 264
A rotor banner consists in a set of images that will be changing. This module is made using jquery.

Code

function rotor_views_post_render(&$view) {
  foreach ($view->display as $display) {
    if ($display->id == $view->current_display && get_class($view->style_plugin) == 'rotor_plugin_style_rotor') {
      $delta = $view->name . '-' . $view->current_display;
      $settings = array(
        'RotorBanner' => array(),
      );
      $settings['RotorBanner'][$delta]['view_id'] = $view->name;
      $settings['RotorBanner'][$delta]['display_id'] = $view->current_display;
      $settings['RotorBanner'][$delta]['effect'] = $view->style_plugin->options['effect'];
      $settings['RotorBanner'][$delta]['time'] = $view->style_plugin->options['seconds'];
      $settings['RotorBanner'][$delta]['speed'] = $view->style_plugin->options['speed'] == 0 ? 1 : $view->style_plugin->options['speed'] * 1000;
      $settings['RotorBanner'][$delta]['pause'] = $view->style_plugin->options['pause'];
      _rotor_doheader();
      drupal_add_js($settings, 'setting');
    }
  }
}