protected function generateRows($data)
{
if (empty($data)) {
return '';
}
if (is_string($data)) {
return $data;
}
$rows = '';
if (is_array($data)) {
foreach ($data as $row) {
if (empty($row['columns'])) {
continue;
}
$rowOptions = ArrayHelper::getValue($row, 'options', []);
$rows .= Html::beginTag('tr', $rowOptions);
foreach ($row['columns'] as $col) {
$colOptions = ArrayHelper::getValue($col, 'options', []);
$colContent = ArrayHelper::getValue($col, 'content', '');
$tag = ArrayHelper::getValue($col, 'tag', 'th');
$rows .= "\t" . Html::tag($tag, $colContent, $colOptions) . "\n";
}
$rows .= Html::endTag('tr') . "\n";
}
}
return $rows;
}