public function BlazyViews::render in Blazy 8.2
Same name and namespace in other branches
- 8 src/Plugin/views/style/BlazyViews.php \Drupal\blazy\Plugin\views\style\BlazyViews::render()
- 7 src/Plugin/views/style/BlazyViews.php \Drupal\blazy\Plugin\views\style\BlazyViews::render()
Overrides StylePluginBase::render().
Overrides StylePluginBase::render
File
- src/
Plugin/ views/ style/ BlazyViews.php, line 88
Class
- BlazyViews
- Blazy style plugin.
Namespace
Drupal\blazy\Plugin\views\styleCode
public function render() {
$settings = $this
->buildSettings();
$settings['item_id'] = 'content';
$settings['namespace'] = 'blazy';
$elements = [];
foreach ($this
->renderGrouping($this->view->result, $settings['grouping']) as $rows) {
$items = [];
foreach ($rows as $index => $row) {
$this->view->row_index = $index;
$items[$index] = $this->view->rowPlugin
->render($row);
}
// 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);
unset($this->view->row_index, $items);
}
return $elements;
}