diff --git a/ajax/brick/infinite/row.php b/ajax/brick/infinite/row.php index 8ca6b2ccc7339cf5ce4099faf7eb57ede384245f..08b66a1d1ce4ba01477dc4c9daccba3c9045cd5c 100644 --- a/ajax/brick/infinite/row.php +++ b/ajax/brick/infinite/row.php @@ -32,10 +32,10 @@ function ($brickId, $brickUID, $row) { $Infinite = new Infinite($settings); $Engine->assign(array( - 'children' => $Infinite->getRow((int)$row), - 'row' => (int)$row, - 'this' => $Infinite, - 'gridClass' =>$Infinite->getAttribute('gridClass') + 'children' => $Infinite->getRow((int)$row), + 'row' => (int)$row, + 'this' => $Infinite, + 'gridClass' => $Infinite->getAttribute('gridClass') )); return $Engine->fetch($Infinite->getRowTemplate()); diff --git a/src/QUI/Bricks/Controls/Children/Infinite.php b/src/QUI/Bricks/Controls/Children/Infinite.php index 92fc70b647a7cf6aa31ff3c2e7c7074ba1b6c53c..9882a590b9590067ff30e5963be66f6ad37d64a3 100644 --- a/src/QUI/Bricks/Controls/Children/Infinite.php +++ b/src/QUI/Bricks/Controls/Children/Infinite.php @@ -50,37 +50,45 @@ public function getBody() { $Engine = QUI::getTemplateManager()->getEngine(); $children = ''; + $rows = $this->getAttribute('rows'); switch ($this->getAttribute('childrenPerRow')) { - case 2 : + case 2: $this->setAttribute('gridClass', 'grid-50'); break; - case 3 : + + case 3: $this->setAttribute('gridClass', 'grid-33'); break; - case 4 : + + case 4: $this->setAttribute('gridClass', 'grid-25'); break; - case 5 : + + case 5: $this->setAttribute('gridClass', 'grid-20'); break; - default : + + default: $this->setAttribute('gridClass', 'grid-25'); } - - $this->setAttribute( 'data-qui-options-childrenperrow', $this->getAttribute('childrenPerRow') - ); - for ($i = 0, $len = (int)$this->getAttribute('rows'); $i < $len; $i++) { + $rows = (int)$rows; + + if (empty($rows)) { + $rows = 1; + } + + for ($i = 0, $len = $rows; $i < $len; $i++) { $Engine->assign(array( - 'children' => $this->getRow($i), - 'row' => $i, - 'this' => $this, + 'children' => $this->getRow($i), + 'row' => $i, + 'this' => $this, 'gridClass' => $this->getAttribute('gridClass') ));