public function run() { if ($this->model === null) { $inputId = $this->getId(); } else { if ($this->getId(false) === null) { $inputId = Html::getInputId($this->model, $this->attribute); $this->setId($inputId); } else { $inputId = $this->getId(); } } $widgetId = $inputId . '-map'; if ($this->name === null) { $inputName = $this->model === null ? null : Html::getInputName($this->model, $this->attribute); } else { $inputName = $this->name; } if ($this->enableSearchBox === true) { $this->_renderSearchBox(); } // render attribute as hidden input if ($this->model === null) { echo Html::hiddenInput($inputName, $this->value, ['id' => $inputId, 'name' => $inputName]); } else { echo Html::activeHiddenInput($this->model, $this->attribute, ['id' => $inputId, 'name' => $inputName]); } $this->_registerOnChangedEvent($this->id); $this->_registerOnInitializedEvent(); $this->_setClientLocation(); $widgetOptions = $this->options; unset($widgetOptions['id']); echo LocationPickerWidget::widget(['id' => $widgetId, 'key' => $this->key, 'options' => $widgetOptions, 'clientOptions' => $this->clientOptions, 'clientEvents' => $this->clientEvents]); }
public function run() { if ($this->enableSearchBox === true) { $this->_renderSearchBox(); } // render attribute as hidden input echo Html::activeHiddenInput($this->model, $this->attribute); $attributeId = Html::getInputId($this->model, $this->attribute); $this->_registerOnChangedEvent($attributeId); $this->_registerOnInitializedEvent(); $this->_setClientLocation(); $widgetOptions = $this->options; if (isset($widgetOptions['id'])) { unset($widgetOptions['id']); } echo LocationPickerWidget::widget(['key' => $this->key, 'options' => $widgetOptions, 'clientOptions' => $this->clientOptions, 'clientEvents' => $this->clientEvents]); }
use yii\helpers\BaseHtml; $form = ActiveForm::begin(['id' => $model->formName()]); ?> <?php echo $form->field($model, 'CUST_KD')->textInput(['value' => $id, 'disabled' => true]); ?> <?php echo $form->field($model, 'ALAMAT')->textInput(['readonly' => true]); ?> <?php echo BaseHtml::activeHiddenInput($model, 'MAP_LAT'); ?> <?php echo BaseHtml::activeHiddenInput($model, 'MAP_LNG'); ?> <?php echo \pigolab\locationpicker\LocationPickerWidget::widget(['options' => ['style' => 'width: 100%; height: 400px'], 'clientOptions' => ['location' => ['latitude' => -6.1783, 'longitude' => 106.6319], 'radius' => 300, 'inputBinding' => ['latitudeInput' => new JsExpression("\$('#customers-map_lat')"), 'longitudeInput' => new JsExpression("\$('#customers-map_lng')"), 'locationNameInput' => new JsExpression("\$('#customers-alamat')")]]]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'SAVE' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end();