@@ -43,13 +43,16 @@ |
||
43 | 43 | 'value' => !is_null($country) ? (new AddressHelper())->formatList($country->getDivisions()) : [], |
44 | 44 | ], |
45 | 45 | ]);?> |
46 | - <?php else:?> |
|
46 | + <?php else { |
|
47 | + :?> |
|
47 | 48 | <?= $form->field($model, 'state')->widget(Select2::class, [ |
48 | 49 | 'data'=> ArrayHelper::map((new AddressHelper())->formatList($country->getDivisions()),'id', 'name'), |
49 | 50 | 'options' => [ |
50 | 51 | 'placeholder' => $widget->placeHolders['state'], |
51 | 52 | ], |
52 | - ]);?> |
|
53 | + ]); |
|
54 | +} |
|
55 | +?> |
|
53 | 56 | <?php endif;?> |
54 | 57 | </div> |
55 | 58 | </div> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use tonisormisson\addressform\AddressHelper; |
10 | 10 | use yii\helpers\ArrayHelper; |
11 | 11 | |
12 | -$country =$widget->getCountry(); |
|
12 | +$country = $widget->getCountry(); |
|
13 | 13 | $countryDisabled = !is_null($country); |
14 | 14 | ?> |
15 | 15 | |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | 'pluginOptions'=>[ |
28 | 28 | 'placeholder' => $widget->placeHolders['country'], |
29 | 29 | ], |
30 | - ]);?> |
|
31 | - <?= $countryDisabled ? $form->field($model, 'country')->hiddenInput(['value'=> $country->getIsoAlpha2()])->label(false) : null ?> |
|
30 | + ]); ?> |
|
31 | + <?= $countryDisabled ? $form->field($model, 'country')->hiddenInput(['value'=> $country->getIsoAlpha2()])->label(false) : null ?> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class="col-sm-6"> |
35 | - <?php if(is_null($country)):?> |
|
35 | + <?php if (is_null($country)):?> |
|
36 | 36 | <?= $form->field($model, 'state')->widget(DepDrop::class, [ |
37 | 37 | 'type'=>DepDrop::TYPE_SELECT2, |
38 | 38 | 'select2Options'=>['pluginOptions'=>['allowClear'=>true]], |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | 'loadingText' => Yii::t("addressform", "Loading") . "...", |
44 | 44 | 'value' => !is_null($country) ? (new AddressHelper())->formatList($country->getDivisions()) : [], |
45 | 45 | ], |
46 | - ]);?> |
|
46 | + ]); ?> |
|
47 | 47 | <?php else:?> |
48 | 48 | <?= $form->field($model, 'state')->widget(Select2::class, [ |
49 | - 'data'=> ArrayHelper::map((new AddressHelper())->formatList($country->getDivisions()),'id', 'name'), |
|
49 | + 'data'=> ArrayHelper::map((new AddressHelper())->formatList($country->getDivisions()), 'id', 'name'), |
|
50 | 50 | 'options' => [ |
51 | 51 | 'placeholder' => $widget->placeHolders['state'], |
52 | 52 | ], |
53 | - ]);?> |
|
54 | - <?php endif;?> |
|
53 | + ]); ?> |
|
54 | + <?php endif; ?> |
|
55 | 55 | </div> |
56 | 56 | </div> |
@@ -22,7 +22,7 @@ |
||
22 | 22 | <?= (in_array('postCode', $widget->disabledFields)) ? null: $form->field($model, 'postCode')->textInput(['placeholder'=>$widget->placeHolders['postCode']]) ?> |
23 | 23 | </div> |
24 | 24 | </div> |
25 | - <?= empty($widget->form) ? Html::submitButton($widget->submitText,$widget->submitOptions) : null?> |
|
25 | + <?= empty($widget->form) ? Html::submitButton($widget->submitText, $widget->submitOptions) : null?> |
|
26 | 26 | |
27 | 27 | <?php (empty($widget->form)) ? ActiveForm::end() : null?> |
28 | 28 | <?= Html::endTag("div")?> |
29 | 29 | \ No newline at end of file |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | $countryList = []; |
106 | 106 | foreach ($this->countries as $country) { |
107 | - $countryList[$country->getIsoAlpha2()] = $country->getEmoji(). " " . $country->getName(); |
|
107 | + $countryList[$country->getIsoAlpha2()] = $country->getEmoji() . " " . $country->getName(); |
|
108 | 108 | } |
109 | 109 | return $countryList; |
110 | 110 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $params = []; |
145 | 145 | if (!empty($this->disabledFields)) { |
146 | 146 | $requiredFields = array_diff(Address::$defaultRequiredFields, $this->disabledFields); |
147 | - $params['requiredFields'] = $requiredFields; |
|
147 | + $params['requiredFields'] = $requiredFields; |
|
148 | 148 | } |
149 | 149 | $this->address = new Address($params); |
150 | 150 | } |