src/widgets/LocationFormWidget.php
protected function city()
    {
        $pluginOptions = [
            'url' => Url::to(["/{$this->module->id}/city/list"])
            , 'depends' => [$this->fieldIds['country']]
        ];
        if (isset($this->fieldIds['state'])) {
            $pluginOptions['depends'][] = $this->fieldIds['state'];
            $pluginOptions['initDepends'] = [$this->fieldIds['country']];
        } else {
            $pluginOptions['depends'][] = null;
        }

        if (isset($this->fieldIds['region'])) {
            $pluginOptions['depends'][] = $this->fieldIds['region'];
            if (isset($this->fieldIds['state'])) {
                $pluginOptions['initDepends'][] = $this->fieldIds['state'];
            }
        } else {
            $pluginOptions['depends'][] = null;
        }

        $this->parts['{city}'] = $this->form->field($this->model, $this->model->getCityPropertyName())->widget(DepDrop::className(), [
            'options' => [
                'id' => $this->fieldIds['city']
                , 'cityholder' => Yii::t('jlorente/location', 'Select city')
                , 'name' => $this->getSubmitModelName($this->model->getCityPropertyName())
            ]
            , 'data' => ArrayHelper::map(City::find()->where(['region_id' => $this->model->region_id])->orderBy(['name' => SORT_ASC])->all(), 'id', 'name')
            , 'pluginOptions' => $pluginOptions
        ]);
    }
protected function city()
    {
        $pluginOptions = [
            'url' => Url::to(["/{$this->module->id}/city/list"])
            , 'depends' => [$this->fieldIds['country']]
        ];
        if (isset($this->fieldIds['state'])) {
            $pluginOptions['depends'][] = $this->fieldIds['state'];
            $pluginOptions['initDepends'] = [$this->fieldIds['country']];
        } else {
            $pluginOptions['depends'][] = null;
        }

        if (isset($this->fieldIds['region'])) {
            $pluginOptions['depends'][] = $this->fieldIds['region'];
            if (isset($this->fieldIds['state'])) {
                $pluginOptions['initDepends'][] = $this->fieldIds['state'];
            }
        } else {
            $pluginOptions['depends'][] = null;
        }

        $this->parts['{city}'] = $this->form->field($this->model, $this->model->getCityPropertyName())->widget(DepDrop::className(), [
            'options' => [
                'id' => $this->fieldIds['city']
                , 'cityholder' => Yii::t('jlorente/location', 'Select city')
                , 'name' => $this->getSubmitModelName($this->model->getCityPropertyName())
            ]
            , 'data' => ArrayHelper::map(City::find()->where(['region_id' => $this->model->region_id])->orderBy(['name' => SORT_ASC])->all(), 'id', 'name')
            , 'pluginOptions' => $pluginOptions
        ]);
    }
protected function city ( ) { $ pluginOptions = [ 'url' => Url :: to ( [ "/{$this->module->id}/city/list" ] ) , 'depends' => [ $ this -> fieldIds [ 'country' ] ] ] ; if ( isset ( $ this -> fieldIds [ 'state' ] ) ) { $ pluginOptions [ 'depends' ] [ ] = $ this -> fieldIds [ 'state' ] ; $ pluginOptions [ 'initDepends' ] = [ $ this -> fieldIds [ 'country' ] ] ; } else { $ pluginOptions [ 'depends' ] [ ] = null ; } if ( isset ( $ this -> fieldIds [ 'region' ] ) ) { $ pluginOptions [ 'depends' ] [ ] = $ this -> fieldIds [ 'region' ] ; if ( isset ( $ this -> fieldIds [ 'state' ] ) ) { $ pluginOptions [ 'initDepends' ] [ ] = $ this -> fieldIds [ 'state' ] ; } } else { $ pluginOptions [ 'depends' ] [ ] = null ; } $ this -> parts [ '{city}' ] = $ this -> form -> field ( $ this -> model , $ this -> model -> getCityPropertyName ( ) ) -> widget ( DepDrop :: className ( ) , [ 'options' => [ 'id' => $ this -> fieldIds [ 'city' ] , 'cityholder' => Yii :: t ( 'jlorente/location' , 'Select city' ) , 'name' => $ this -> getSubmitModelName ( $ this -> model -> getCityPropertyName ( ) ) ] , 'data' => ArrayHelper :: map ( City :: find ( ) -> where ( [ 'region_id' => $ this -> model -> region_id ] ) -> orderBy ( [ 'name' => SORT_ASC ] ) -> all ( ) , 'id' , 'name' ) , 'pluginOptions' => $ pluginOptions ] ) ; }
Renders the city part.
Renders the city part .