You are here

public function SlickManager::prepareGridAttributes in Slick Carousel 7.3

Prepare attributes for the known module features, not necessarily users'.

1 call to SlickManager::prepareGridAttributes()
SlickManager::buildGridItem in src/SlickManager.php
Returns items as a grid item display.

File

src/SlickManager.php, line 419

Class

SlickManager
Implements SlickManagerInterface.

Namespace

Drupal\slick

Code

public function prepareGridAttributes(array $settings = []) {

  // By default Slick only supports Grid Foundation, adds relevant grid_id for
  // optional Style: CSS3 Columns, and probably future flexbox.
  // @todo use BlazyGrid::attributes($attributes, $settings); anytime.
  $grid_id = empty($settings['style']) ? 'grid' : $settings['style'];
  $classes[] = 'block-columngrid block-' . $grid_id;
  $classes[] = $settings['unslick'] ? 'slick__grid' : 'slide__content';
  $settings['grid_large'] = $settings['grid'];
  foreach ([
    'small',
    'medium',
    'large',
  ] as $grid) {
    if ($column = $settings['grid_' . $grid]) {
      $classes[] = $grid . '-block-' . $grid_id . '-' . $column;
    }
  }
  foreach ($classes as $class) {
    $attributes['class'][] = $class;
  }

  // Support a grid of lightbox or inline multimedia gallery.
  if (!empty($settings['media_switch'])) {
    $switch = str_replace('_', '-', $settings['media_switch']);
    $attributes['data-' . $switch . '-gallery'] = TRUE;
  }
  return $attributes;
}