/**
* @inheritdoc
*/
public function renderItems()
{
if ($this->columns < 2) {
parent::renderItems();
return;
}
$models = $this->dataProvider->getModels();
$keys = $this->dataProvider->getKeys();
$rows = [];
$layouts = ArrayHelper::getValue($this->columnsLayout, $this->columns, []);
$this->itemOptions = empty($this->itemOptions) ? $this->buildItemOptions($layouts) : $this->itemOptions;
foreach (array_values($models) as $index => $model) {
$rows[] = $this->renderItem($model, $keys[$index], $index);
// set a clearfix breaks for responsive columns
if ($this->createRows) {
$clearRows = $this->buildClearFixTag($layouts, $index + 1);
if (empty($clearRows)) {
continue;
}
$rows[] = implode("\n", $clearRows);
}
}
return Html::beginTag('div', $this->rowOptions) . implode($this->separator, $rows) . Html::endTag('div');
}