You are here

function template_preprocess_slick_grid in Slick Carousel 7.3

Same name and namespace in other branches
  1. 8.2 templates/slick.theme.inc \template_preprocess_slick_grid()
  2. 8 templates/slick.theme.inc \template_preprocess_slick_grid()
  3. 7.2 templates/slick.theme.inc \template_preprocess_slick_grid()

Prepares variables for theme_slick_grid().

File

templates/slick.theme.inc, line 503
Hooks and preprocess functions for the Slick module.

Code

function template_preprocess_slick_grid(&$variables) {
  _slick_preprocess_container($variables);
  $settings = $variables['settings'];
  foreach ($variables['items'] as $delta => $item) {
    $settings = isset($item['settings']) ? array_merge($settings, $item['settings']) : $settings;
    $settings['current_item'] = 'grid';
    $item_attributes = empty($item['attributes']) ? [] : $item['attributes'];
    $classes = empty($item_attributes['class']) ? [] : (array) $item_attributes['class'];
    if (empty($settings['unslick'])) {
      $classes[] = 'slide__grid';
    }
    $item_attributes['class'] = array_merge([
      'grid',
    ], $classes);
    unset($item['settings'], $item['attributes']);
    $slide['slide'] = [
      '#theme' => empty($settings['vanilla']) ? 'slick_slide' : 'slick_vanilla',
      '#item' => $item,
      '#delta' => $delta,
      '#settings' => $settings,
    ];
    $variables['item_attributes_array'][$delta] = $item_attributes;
    $variables['items'][$delta] = $slide;
    unset($slide);
  }
}