You are here

flickity_views.theme.inc in Flickity Carousel 8

File

modules/views/theme/flickity_views.theme.inc
View source
<?php

/**
 * @file
 * flickity_views.theme.inc
 */

/**
 * Template preprocess Flickity Views variables.
 */
function template_preprocess_flickity_views(&$variables) {
  if (!empty($variables['view'])) {
    $items = array();
    foreach ($variables['rows'] as $id => $row) {
      $items[] = array(
        'row' => \Drupal::service('renderer')
          ->render($row),
      );
    }

    // Row items & instance settings.
    $variables['settings'] = $variables['view']->style_plugin->options;
    $variables['items'] = $items;
  }
}

/**
 * Theme declaration for Flickity Views.
 */
function theme_flickity_views($variables) {
  $output = array(
    '#theme' => 'flickity',
    '#items' => $variables['items'],
    '#settings' => $variables['settings']['settings'],
  );
  return drupal_render($output);
}

Functions

Namesort descending Description
template_preprocess_flickity_views Template preprocess Flickity Views variables.
theme_flickity_views Theme declaration for Flickity Views.