You are here

function jssor_preprocess_jssor in Jssor Slider 7

Implements hook_preprocess_jssor().

File

./jssor.module, line 84
Allows support of a new view handler.

Code

function jssor_preprocess_jssor(&$variables) {

  // Do some D7 fixing from the D8 theme.
  foreach ($variables['rows'] as $i => $row) {
    $variables['rows'][$i]['attributes'] = $variables['rows'][$i]['attributes']->attributes;
  }
  $variables['view']->element['#attached']['library'] = array(
    array(
      'jssor',
      'jquery.jssor.slider',
    ),
  );
  drupal_add_js(array(
    'jssor' => $variables['view']->element['#attached']['drupalSettings'],
  ), array(
    'type' => 'setting',
    'weight' => 0,
  ));
  drupal_add_js('var drupalSettings = Drupal.settings.jssor;', array(
    'type' => 'inline',
    'scope' => 'footer',
    'weight' => 1,
  ));
  drupal_add_library('jssor', 'jquery.jssor.slider');
}