You are here

public function BlazyViewsTest::render in Blazy 8

Same name and namespace in other branches
  1. 8.2 tests/modules/blazy_test/src/Plugin/views/style/BlazyViewsTest.php \Drupal\blazy_test\Plugin\views\style\BlazyViewsTest::render()

Overrides StylePluginBase::render().

Overrides StylePluginBase::render

File

tests/modules/blazy_test/src/Plugin/views/style/BlazyViewsTest.php, line 79

Class

BlazyViewsTest
Blazy Views Test style plugin.

Namespace

Drupal\blazy_test\Plugin\views\style

Code

public function render() {
  $view = $this->view;
  $settings = $this->options + BlazyDefault::entitySettings();
  $settings['item_id'] = 'box';
  $settings['caption'] = array_filter($settings['caption']);
  $settings['namespace'] = 'blazy';
  $settings['ratio'] = '';
  $settings['_views'] = TRUE;
  $elements = [];
  foreach ($this
    ->renderGrouping($view->result, $settings['grouping']) as $rows) {
    $items = $this
      ->buildElements($settings, $rows);

    // Supports Blazy formatter multi-breakpoint images if available.
    $item = isset($items[0]) ? $items[0] : NULL;
    $this
      ->blazyManager()
      ->isBlazy($settings, $item);
    $elements = BlazyGrid::build($items, $settings);
  }
  return $elements;
}