Skip to content

Commit 0608a8e

Browse files
author
Eugene Tupikov
committed
Hidden fields no longer break markup
1 parent af20d4d commit 0608a8e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/MultipleInput.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,12 @@ private function getRowTemplate()
216216
$cells[] = $this->renderActionColumn();
217217
}
218218

219-
$this->template = implode("\n", $hiddenInputs);
220-
$this->template .= Html::tag('tr', implode("\n", $cells), [
219+
if (!empty($hiddenInputs)) {
220+
$hiddenInputs = implode("\n", $hiddenInputs);
221+
$cells[0] = preg_replace('/^(<td[^>]+>)(.*)(<\/td>)$/', '\${1}' . $hiddenInputs . '$2$3', $cells[0]);
222+
}
223+
224+
$this->template = Html::tag('tr', implode("\n", $cells), [
221225
'class' => 'multiple-input-list__item',
222226
]);
223227

0 commit comments

Comments
 (0)