You are here

views_fractionslider.module in Views FractionSlider 7.2

Provide an fractionslider display style for Views.

This is a placeholder file so drupal will enable the module. All logic is contained in other files located with the module.

File

views/views_fractionslider.module
View source
<?php

/**
 * @file
 * Provide an fractionslider display style for Views.
 *
 * This is a placeholder file so drupal will enable the module. All logic is
 * contained in other files located with the module.
 */

/**
 * Implements hook_views_api().
 */
function views_fractionslider_views_api() {
  return array(
    'api' => 3,
  );
}

/**
 * Implements hook_preprocess().
 */
function template_preprocess_views_view_fractionslider(&$variables) {
  $view = $variables['view'];
  $options = $view->style_plugin->options;
  $variables['viewname'] = $view->name;
  $variables['class'] = $options['class'];
  $variables['pager'] = $options['pager'];
  $variables['controls'] = $options['controls'];
  $variables['views_dimensions'] = $options['views_dimensions'];
  $variables['views_fullwidth'] = $options['views_fullwidth'];
  $variables['views_responsive'] = $options['views_responsive'];
  $variables['views_increase'] = $options['views_increase'];
  libraries_load('fractionslider');
  drupal_add_js(array(
    'viewsfractionslider' => array(
      'controls' => $variables['controls'],
      'pager' => $variables['pager'],
      'dimensions' => $variables['views_dimensions'],
      'fullwidth' => $variables['views_fullwidth'],
      'responsive' => $variables['views_responsive'],
      'increase' => $variables['views_increase'],
    ),
  ), 'setting');
}

/**
 * Preprocess theme function to print a single record from a row, with fields.
 */
function views_fractionslider_preprocess_views_view_fields(&$vars) {
  $view = $vars['view'];
  if ($view->style_plugin->plugin_name == 'views_fractionslider') {
    foreach ($vars['fields'] as $id => $field) {
      $options = $view->style_options[$id];
      $position = 'data-position="' . $options['space'] . ',' . $options['lspace'] . '"';
      $in = ' data-in="' . $options['data-in'] . '"';
      $out = ' data-out="' . $options['data-out'] . '"';
      $step = ' data-step="' . $options['data-step'] . '"';
      $time = ' data-time="' . $options['data-time'] . '"';
      $easein = ' data-ease-in="' . $options['data-ease-in'] . '"';
      $easeout = ' data-ease-out="' . $options['data-ease-out'] . '"';
      $attributes = $position . $in . $out . $step . $time . $easein . $easeout;
      $frac_wrap = '<div class="slide-in views-fraction-' . $id . '" ' . $attributes . '>';
      $field->wrapper_prefix = $frac_wrap . $field->wrapper_prefix;
      $field->wrapper_suffix = $field->wrapper_suffix . '</div>';
    }
  }
}

Functions

Namesort descending Description
template_preprocess_views_view_fractionslider Implements hook_preprocess().
views_fractionslider_preprocess_views_view_fields Preprocess theme function to print a single record from a row, with fields.
views_fractionslider_views_api Implements hook_views_api().