Borales / yii2-phone-input

Yii2 International telephone numbers
Other
135 stars 55 forks source link

Fix options merging #63

Open esl51 opened 4 years ago

esl51 commented 4 years ago

ArrayHelper::merge merging from second array to first. Now we can override default options.

esl51 commented 4 years ago

https://www.yiiframework.com/doc/api/2.0/yii-helpers-basearrayhelper#merge()-detail

Borales commented 4 years ago

@esl51 I don't think it needs to be changed:

If each array has an element with the same string key value, the latter will overwrite the former

in this case - defaultOptions will be overwriting options all the time.

esl51 commented 4 years ago

in this case - defaultOptions will be overwriting options all the time.

But I can't overwrite this options.

This is my code (I need to add input-lg class to input):

echo $form->field($model, 'phone', ['options' => [
    'class' => 'form-group form-field-col col-xs-12'
]])->widget(PhoneInput::className(), ['defaultOptions' => [
    'class' => 'form-control input-lg' // this line is not working
]]);