Bootstrap\View\Helper\BootstrapHtmlHelper::splicedRows PHP Метод

splicedRows() публичный Метод

Create a formatted collection of elements while maintaining proper bootstrappy markup. Useful when displaying, for example, a list of products that would require more than the maximum number of columns per row.
public splicedRows ( $breakIndex, array $data, callable $determineContent ) : string
$breakIndex int|string divisible index that will trigger a new row
$data array array collection of data used to render each column
$determineContent callable callable a callback that will be called with the data required to render an individual column
Результат string
    public function splicedRows($breakIndex, array $data, callable $determineContent)
    {
        $rowsHtml = '<div class="row">';
        $count = 1;
        foreach ($data as $index => $colData) {
            $rowsHtml .= $determineContent($colData);
            if ($count % $breakIndex === 0) {
                $rowsHtml .= '<div class="clearfix hidden-xs hidden-sm"></div>';
            }
            $count++;
        }
        $rowsHtml .= '</div>';
        return $rowsHtml;
    }