public function BlazyViewsTest::buildElements in Blazy 8
Same name and namespace in other branches
- 8.2 tests/modules/blazy_test/src/Plugin/views/style/BlazyViewsTest.php \Drupal\blazy_test\Plugin\views\style\BlazyViewsTest::buildElements()
Returns blazy_test contents.
1 call to BlazyViewsTest::buildElements()
- BlazyViewsTest::render in tests/
modules/ blazy_test/ src/ Plugin/ views/ style/ BlazyViewsTest.php - Overrides StylePluginBase::render().
File
- tests/
modules/ blazy_test/ src/ Plugin/ views/ style/ BlazyViewsTest.php, line 106
Class
- BlazyViewsTest
- Blazy Views Test style plugin.
Namespace
Drupal\blazy_test\Plugin\views\styleCode
public function buildElements(array $settings, $rows) {
$build = [];
$view = $this->view;
$item_id = $settings['item_id'];
foreach ($rows as $index => $row) {
$view->row_index = $index;
$box = [];
$box[$item_id] = [];
$box['#settings'] = $settings;
// Use Vanilla if so configured.
if (!empty($settings['vanilla'])) {
$box[$item_id] = $view->rowPlugin
->render($row);
}
else {
// Build individual row/ element contents.
$this
->buildElement($box, $row, $index);
}
// Build blazy items.
$build[] = $box;
unset($box);
}
unset($view->row_index);
return $build;
}