@@ -61,9 +61,11 @@ public function renderHeader()
6161 if ($ this ->max === null || ($ this ->max >= 1 && $ this ->max !== $ this ->min )) {
6262 $ button = $ this ->isAddButtonPositionHeader () ? $ this ->renderAddButton () : '' ;
6363
64- $ cells [] = Html::tag ('th ' , $ button , [
65- 'class ' => 'list-cell__button '
66- ]);
64+ $ cells [] = $ this ->renderButtonHeaderCell ($ button );
65+
66+ if ($ this ->cloneButton ) {
67+ $ cells [] = $ this ->renderButtonHeaderCell ();
68+ }
6769 }
6870
6971 return Html::tag ('thead ' , Html::tag ('tr ' , implode ("\n" , $ cells )));
@@ -127,6 +129,18 @@ private function renderHeaderCell($column)
127129 return Html::tag ('th ' , $ column ->title , $ options );
128130 }
129131
132+ /**
133+ * Renders the button header cell.
134+ * @param string
135+ * @return string
136+ */
137+ private function renderButtonHeaderCell ($ button = '' )
138+ {
139+ return Html::tag ('th ' , $ button , [
140+ 'class ' => 'list-cell__button '
141+ ]);
142+ }
143+
130144 /**
131145 * Renders the body.
132146 *
@@ -186,9 +200,12 @@ private function renderRowContent($index = null, $item = null)
186200 $ cells [] = $ this ->renderCellContent ($ column , $ index );
187201 }
188202 }
189-
203+ if ($ this ->cloneButton ) {
204+ $ cells [] = $ this ->renderCloneColumn ();
205+ }
206+
190207 if (!$ isLastRow ) {
191- $ cells [] = $ this ->renderActionColumn ($ index, false );
208+ $ cells [] = $ this ->renderActionColumn ($ index );
192209 }
193210
194211 if ($ hiddenInputs ) {
@@ -286,6 +303,18 @@ private function renderActionColumn($index = null, $isFirstColumn = false)
286303 ]);
287304 }
288305
306+ /**
307+ * Renders the clone column.
308+ *
309+ * @return string
310+ */
311+ private function renderCloneColumn ()
312+ {
313+ return Html::tag ('td ' , $ this ->renderCloneButton (), [
314+ 'class ' => 'list-cell__button ' ,
315+ ]);
316+ }
317+
289318 private function getActionButton ($ index , $ isFirstColumn )
290319 {
291320 if ($ index === null || $ this ->min === 0 ) {
@@ -342,6 +371,22 @@ private function renderRemoveButton()
342371 return Html::tag ('div ' , $ this ->removeButtonOptions ['label ' ], $ options );
343372 }
344373
374+ /**
375+ * Renders clone button.
376+ *
377+ * @return string
378+ * @throws \Exception
379+ */
380+ private function renderCloneButton ()
381+ {
382+ $ options = [
383+ 'class ' => 'btn multiple-input-list__btn js-input-clone ' ,
384+ ];
385+ Html::addCssClass ($ options , $ this ->cloneButtonOptions ['class ' ]);
386+
387+ return Html::tag ('div ' , $ this ->cloneButtonOptions ['label ' ], $ options );
388+ }
389+
345390 /**
346391 * Returns template for using in js.
347392 *
0 commit comments