File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -76,9 +76,9 @@ class MultipleInput extends InputWidget
76
76
public $ min ;
77
77
78
78
/**
79
- * @var string|array position of add button. By default button is rendered in the row.
79
+ * @var string|array position of add button.
80
80
*/
81
- public $ addButtonPosition = self :: POS_ROW ;
81
+ public $ addButtonPosition ;
82
82
83
83
/**
84
84
* @var array|\Closure the HTML attributes for the table body rows. This can be either an array
Original file line number Diff line number Diff line change @@ -69,9 +69,9 @@ class TabularInput extends Widget
69
69
public $ models ;
70
70
71
71
/**
72
- * @var string|array position of add button. By default button is rendered in the row.
72
+ * @var string|array position of add button.
73
73
*/
74
- public $ addButtonPosition = self :: POS_ROW ;
74
+ public $ addButtonPosition ;
75
75
76
76
/**
77
77
* @var array|\Closure the HTML attributes for the table body rows. This can be either an array
Original file line number Diff line number Diff line change @@ -182,6 +182,9 @@ private function prepareLimit()
182
182
183
183
private function prepareButtons ()
184
184
{
185
+ if ($ this ->addButtonPosition === null || $ this ->addButtonPosition === []) {
186
+ $ this ->addButtonPosition = $ this ->min === 0 ? self ::POS_HEADER : self ::POS_ROW ;
187
+ }
185
188
if (!is_array ($ this ->addButtonPosition )) {
186
189
$ this ->addButtonPosition = (array ) $ this ->addButtonPosition ;
187
190
}
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ public function renderHeader()
59
59
}
60
60
61
61
if ($ this ->limit === null || ($ this ->limit >= 1 && $ this ->limit !== $ this ->min )) {
62
- $ button = $ this ->min === 0 || $ this -> isAddButtonPositionHeader () ? $ this ->renderAddButton () : '' ;
62
+ $ button = $ this ->isAddButtonPositionHeader () ? $ this ->renderAddButton () : '' ;
63
63
64
64
$ cells [] = Html::tag ('th ' , $ button , [
65
65
'class ' => 'list-cell__button '
You can’t perform that action at this time.
0 commit comments