You are here

public function SlickGrouping::render in Slick Views 8.2

Same name and namespace in other branches
  1. 7.3 src/Plugin/views/style/SlickGrouping.php \Drupal\slick_views\Plugin\views\style\SlickGrouping::render()

Overrides StylePluginBase::render().

File

src/Plugin/views/style/SlickGrouping.php, line 102

Class

SlickGrouping
Slick style plugin with grouping support.

Namespace

Drupal\slick_views\Plugin\views\style

Code

public function render() {
  $sets = parent::render();
  $settings = $this->options;
  $grouping = empty($settings['grouping']) ? [] : array_filter($settings['grouping']);
  $tabs = !empty($settings['grouping_optionset']) && !empty($settings['optionset_thumbnail']);
  $tags = [
    'span',
    'a',
    'em',
    'strong',
    'i',
    'button',
  ];
  if (!empty($grouping) && $tabs) {
    foreach ($sets as $set) {
      $options = [];
      $options['nav'] = TRUE;
      $options['skin'] = '';
      $options['skin_thumbnail'] = $settings['skin_thumbnail'];
      $options['thumbnail_position'] = $settings['thumbnail_position'];
      $options['optionset'] = $settings['grouping_optionset'];
      $options['optionset_thumbnail'] = $settings['optionset_thumbnail'];
      $slide = [
        'settings' => $options,
        'slide' => $set,
      ];
      $thumb['slide']['#markup'] = empty($set['#title']) ? '' : strip_tags($set['#title'], '<span><a><em><strong><i><button>');
      $thumb['slide']['#allowed_tags'] = $tags;
      $build['items'][] = $slide;
      $build['thumb']['items'][] = $thumb;
      unset($slide, $thumb);
    }
    $build['settings'] = $options;
    $sets = $this->manager
      ->build($build);
  }
  return $sets;
}