Skip to content

Commit f7dc94a

Browse files
authored
set tabindex in renderWidget
options inside options $form->field($model, 'phones')->widget(MultipleInput::className(), [ .., 'columns' => [ 'options' => [ 'options' => ['class' => 'form-control', 'tabindex' => '5'], ], ] ]);
1 parent 54f670d commit f7dc94a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/components/BaseColumn.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ protected function renderRadioList($name, $value, $options)
473473
'label' => $label,
474474
'value' => $value,
475475
'data-id' => ArrayHelper::getValue($options, 'id'),
476-
'tabindex' => $options['tabindex']
476+
'tabindex' => self::TABINDEX
477477
]);
478478

479479
return Html::tag('div', $content, ['class' => 'radio']);
@@ -534,7 +534,7 @@ protected function renderCheckboxList($name, $value, $options)
534534
'label' => $label,
535535
'value' => $value,
536536
'data-id' => ArrayHelper::getValue($options, 'id'),
537-
'tabindex' => $options['tabindex']
537+
'tabindex' => self::TABINDEX
538538
]);
539539

540540
return Html::tag('div', $content, ['class' => 'checkbox']);
@@ -633,9 +633,9 @@ protected function renderDefault($name, $value, $options)
633633
*/
634634
protected function renderWidget($type, $name, $value, $options)
635635
{
636-
if (!isset($options['tabindex'])) {
637-
$options['tabindex'] = self::TABINDEX;
638-
}
636+
637+
$tabindex = isset($options['options']['tabindex']) ? $options['options']['tabindex'] : self::TABINDEX;
638+
unset($options['tabindex']);
639639

640640
$model = $this->getModel();
641641
if ($model instanceof Model) {
@@ -646,7 +646,7 @@ protected function renderWidget($type, $name, $value, $options)
646646
'options' => [
647647
'id' => $this->normalize($name),
648648
'name' => $name,
649-
'tabindex' => $options['tabindex'],
649+
'tabindex' => $tabindex,
650650
'value' => $value
651651
]
652652
];
@@ -657,7 +657,7 @@ protected function renderWidget($type, $name, $value, $options)
657657
'options' => [
658658
'id' => $this->normalize($name),
659659
'name' => $name,
660-
'tabindex' => $options['tabindex'],
660+
'tabindex' => $tabindex,
661661
'value' => $value
662662
]
663663
];

0 commit comments

Comments
 (0)