You are here

public function SlickViews::render in Slick Views 8.2

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

Overrides StylePluginBase::render().

File

src/Plugin/views/style/SlickViews.php, line 34

Class

SlickViews
Slick style plugin.

Namespace

Drupal\slick_views\Plugin\views\style

Code

public function render() {
  $settings = $this
    ->buildSettings();
  $elements = [];
  foreach ($this
    ->renderGrouping($this->view->result, $settings['grouping']) as $rows) {
    $build = $this
      ->buildElements($settings, $rows);

    // Extracts Blazy formatter settings if available.
    if (empty($settings['vanilla']) && isset($build['items'][0])) {
      $this
        ->blazyManager()
        ->isBlazy($settings, $build['items'][0]);
    }

    // Supports Blazy multi-breakpoint images if using Blazy formatter.
    $settings['first_image'] = isset($rows[0]) ? $this
      ->getFirstImage($rows[0]) : [];
    $build['settings'] = $settings;
    $elements = $this->manager
      ->build($build);
    unset($build);
  }
  return $elements;
}