You are here

public function BlazyViewsTest::render in Blazy 8.2

Same name and namespace in other branches
  1. 8 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 78

Class

BlazyViewsTest
Blazy Views Test style plugin.

Namespace

Drupal\blazy_test\Plugin\views\style

Code

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

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