当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::hiddenInput方法代码示例

本文整理汇总了PHP中yii\helpers\Html::hiddenInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::hiddenInput方法的具体用法?PHP Html::hiddenInput怎么用?PHP Html::hiddenInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\Html的用法示例。


在下文中一共展示了Html::hiddenInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderSavedValueInput

 public function renderSavedValueInput()
 {
     if ($this->hasModel()) {
         $value = Html::getAttributeValue($this->model, $this->attribute);
     } else {
         $value = $this->value;
     }
     if ($value !== null && $value !== '') {
         // format value according to saveDateFormat
         try {
             $value = Yii::$app->formatter->asDate($value, $this->saveDateFormat);
         } catch (InvalidParamException $e) {
             // ignore exception and keep original value if it is not a valid date
         }
     }
     $this->options['savedValueInputID'] = $this->options['id'] . '-saved-value';
     $options = $this->options;
     $options['id'] = $options['savedValueInputID'];
     $options['value'] = $value;
     // render hidden input
     if ($this->hasModel()) {
         $contents = Html::activeHiddenInput($this->model, $this->attribute, $options);
     } else {
         $contents = Html::hiddenInput($this->name, $value, $options);
     }
     return $contents;
 }
开发者ID:michael-vostrikov,项目名称:books-test,代码行数:27,代码来源:DatePicker.php

示例2: api_form

 public function api_form($options = [])
 {
     $model = new FeedbackModel();
     $settings = Yii::$app->getModule('admin')->activeModules['feedback']->settings;
     $options = array_merge($this->_defaultFormOptions, $options);
     ob_start();
     $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send'])]);
     echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0]));
     echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1]));
     echo $form->field($model, 'name');
     echo $form->field($model, 'email')->input('email');
     if ($settings['enablePhone']) {
         echo $form->field($model, 'phone');
     }
     if ($settings['enableTitle']) {
         echo $form->field($model, 'title');
     }
     echo $form->field($model, 'text')->textarea();
     if ($settings['enableCaptcha']) {
         echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
     }
     echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
     ActiveForm::end();
     return ob_get_clean();
 }
开发者ID:DenisCherniatev,项目名称:easyii,代码行数:25,代码来源:Feedback.php

示例3: init

 public function init()
 {
     parent::init();
     \Yii::setAlias('@webuploader', __DIR__);
     if (empty($this->driver)) {
         $this->driver = isset(\Yii::$app->params['webuploader_driver']) ? \Yii::$app->params['webuploader_driver'] : 'local';
     }
     if ($this->driver == 'local') {
         // 初始化@static别名,默认@web/static,最好根据自己的需求提前设置好@static别名
         $static = \Yii::getAlias('@static', false);
         $staticroot = \Yii::getAlias('@staticroot', false);
         if (!$static || !$staticroot) {
             \Yii::setAlias('@static', '@web/static');
             \Yii::setAlias('@staticroot', '@webroot/static');
         }
     }
     $this->server = $this->server ?: Url::to(['/site/webupload', 'driver' => $this->driver]);
     $this->options['boxId'] = isset($this->options['boxId']) ? $this->options['boxId'] : 'picker';
     $this->options['previewWidth'] = isset($this->options['previewWidth']) ? $this->options['previewWidth'] : '250';
     $this->options['previewHeight'] = isset($this->options['previewHeight']) ? $this->options['previewHeight'] : '150';
     if ($this->hasModel()) {
         $this->hiddenInput = Html::activeHiddenInput($this->model, $this->attribute);
     } else {
         $this->hiddenInput = Html::hiddenInput($this->name, $this->value);
     }
 }
开发者ID:yidashi,项目名称:yii2-webuploader,代码行数:26,代码来源:Webuploader.php

示例4: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $jsOptions = ['clientOptions' => $this->clientOptions];
     $this->options['id'] = 'input-id';
     if ($this->hasModel()) {
         echo Html::activeInput('file', $this->model, $this->attribute, $this->options);
         echo Html::img('#', ['id' => 'cropper-box']);
         echo Html::button('Crop', ['id' => 'cropImage']);
         $input_name = Html::getInputName($this->model, $this->attribute);
         $input_id = Html::getInputId($this->model, $this->attribute);
         echo Html::hiddenInput($input_name . '[file]', '', ['id' => $input_id . '_image']);
         $jsOptions['model'] = $this->model;
         $jsOptions['attribute'] = $this->attribute;
     } else {
         echo Html::fileInput($this->name, $this->value, $this->options);
         echo Html::img('#', ['id' => 'cropper-box']);
         echo Html::button('Crop', ['id' => 'cropImage']);
     }
     if ($this->uploadUrl) {
         $this->uploadUrl = \Yii::getAlias($this->uploadUrl);
     }
     $jsOptions['uploadUrl'] = $this->uploadUrl;
     $jsOptions['uploadCroppedUrl'] = $this->uploadCroppedUrl;
     $jsOptions['changeUrl'] = $this->changeUrl;
     $jsOptions['name'] = $this->name;
     $jsOptions['aspectRatio'] = $this->aspectRatio;
     $this->registerPlugin($jsOptions);
 }
开发者ID:servsol,项目名称:yii2-cropper,代码行数:31,代码来源:Cropper.php

示例5: api_form

 public function api_form($options = [])
 {
     $model = new FeedbackModel();
     $settings = Yii::$app->getModule('admin')->activeModules['agencies']->settings;
     $options = array_merge($this->_defaultFormOptions, $options);
     ob_start();
     $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send'])]);
     echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0]));
     echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1]));
     var_dump($model->getErrors());
     echo '   <input type="text" placeholder="Title" class="form-control" name="Feedback[title]" >
                 <input type="text" placeholder="Company Name" class="form-control" name="Feedback[name]" id="feedback-name">
                 <div class="help-block"></div>
                 <input type="text" placeholder="Phone" class="form-control" name="Feedback[phone]" >
                 <input type="text" placeholder="Email" class="form-control" name="Feedback[email]" >
                 <textarea  name="Feedback[text]"  id="feedback-text" class="form-control msg" rows="5" placeholder="your message"></textarea>
                 <div class="row">
                     <div class="col-md-12">
                         <button class="btn dry-btn center-block" type="submit">Send Request</button>
                     </div>
                 </div>';
     //        echo $form->field($model, 'name');
     //        echo $form->field($model, 'email')->input('email');
     //
     //        if($settings['enablePhone']) echo $form->field($model, 'phone');
     //        if($settings['enableTitle']) echo $form->field($model, 'title');
     //
     //        echo $form->field($model, 'text')->textarea();
     //
     //        if($settings['enableCaptcha']) echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
     //
     //        echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
     ActiveForm::end();
     return ob_get_clean();
 }
开发者ID:engmohamedamer,项目名称:gotest,代码行数:35,代码来源:Feedback.php

示例6: run

 public function run()
 {
     if ($this->hasModel()) {
         $replace['{input}'] = Html::activeHiddenInput($this->model, $this->attribute, $this->options);
         $attributeId = Html::getInputId($this->model, $this->attribute);
         $id = Html::getInputId($this->model, 'hydra_' . $this->attribute);
         $name = Html::getInputName($this->model, 'hydra_' . $this->attribute);
         $this->value = $this->model[$this->attribute];
     } else {
         $replace['{input}'] = Html::hiddenInput($this->name, $this->value, $this->options);
         $name = $id = 'hydra_' . $this->name;
         $attributeId = $this->name;
     }
     $fileInputName = empty($this->fileInputName) ? $name : $this->fileInputName;
     $replace['{preview}'] = 'Файл еще не загружен';
     if (!empty($this->value)) {
         $replace['{preview}'] = $this->value;
         $extension = Yii::$app->hydra->getExtension($this->value);
         if (Yii::$app->hydra->isImage($extension)) {
             $replace['{preview}'] = Html::img(Yii::$app->hydra->getCacheUrl($this->value, $this->resolution), ['id' => $id . '_image']);
         }
         $replace['{reset-button}'] = Html::tag($this->resetButton['tag'], $this->resetButton['label'], ArrayHelper::merge(['onClick' => '$("#' . $attributeId . '").val("");$("#' . $id . '_image' . '").remove();$(this).remove();'], $this->resetButton['options']));
     }
     $replace['{input}'] .= Html::fileInput($fileInputName, null, ArrayHelper::merge(['id' => $id], $this->fileInput['options']));
     return strtr($this->template, $replace);
 }
开发者ID:zabachok,项目名称:yii2-hydra,代码行数:26,代码来源:FileInput.php

示例7: api_form

 public function api_form($options = [])
 {
     $model = new FeedbackModel();
     $settings = Yii::$app->getModule('admin')->activeModules['awarness']->settings;
     $options = array_merge($this->_defaultFormOptions, $options);
     ob_start();
     $form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/awarness/send']), 'options' => ['class' => 'col-md-offset-4']]);
     echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0]));
     echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1]));
     echo '
   <div class="form-group center-block col-md-6">';
     '  <input class="form-control" placeholder="Name" name="Feedback[name]">
             <input  class="form-control" placeholder="Subject" name="Feedback[title]">
             <input  class="form-control" placeholder="Your Mail" name="Feedback[email]" >
             <textarea class="form-control" rows="3" placeholder="Your Message" name="Feedback[text]"  id="feedback-text"></textarea>
             <button type="submit" class="btn dry-btn-3 center-block">Send Request</button>
             </div>
             ';
     //        echo $form->field($model, 'name');
     //        echo $form->field($model, 'email')->input('email');
     //
     //        if($settings['enablePhone']) echo $form->field($model, 'phone');
     //        if($settings['enableTitle']) echo $form->field($model, 'title');
     //
     //        echo $form->field($model, 'text')->textarea();
     //
     //        if($settings['enableCaptcha']) echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
     //
     //        echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
     ActiveForm::end();
     return ob_get_clean();
 }
开发者ID:engmohamedamer,项目名称:gotest,代码行数:32,代码来源:Feedback.php

示例8: run

 /**
  * Renders the widget.
  */
 public function run()
 {
     $contents = [];
     if ($this->inline) {
         if ($this->hasModel()) {
             $contents[] = Html::activeHiddenInput($this->model, $this->attribute, $this->options);
         } else {
             $contents[] = Html::hiddenInput($this->name, $this->value, $this->options);
         }
         $contents[] = Html::tag('div', '', $this->containerOptions);
     } else {
         if ($this->hasModel()) {
             $contents[] = Html::activeTextInput($this->model, $this->attribute, $this->options);
         } else {
             $contents[] = Html::textInput($this->name, $this->value, $this->options);
         }
     }
     echo implode("\n", $contents);
     if ($this->language) {
         DatePickerAsset::$extraJs[] = 'plugins/bootstrap-datepicker-extended/js/locales/bootstrap-datepicker.' . $this->language . '.js';
         $this->clientOptions['language'] = $this->language;
     }
     DatePickerAsset::register($this->view);
     $this->registerPlugin('datepicker');
     if ($this->inline) {
         $this->view->registerJs("\n                !(function(\$){\n                    var el = \$('#{$this->options['id']}'),\n                        val = el.val(),\n                        container = \$('#{$this->containerOptions['id']}');\n                    container.on('changeDate', function(e){\n                        el.val(e.format());\n                    });\n                    if(val) {\n                        container.datepicker('update', new Date(Date.parse(val)));\n                    }\n                })(jQuery);\n                ", View::POS_READY);
     }
 }
开发者ID:luobenyu,项目名称:yii2-athens,代码行数:31,代码来源:DatePicker.php

示例9: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         $name = Html::getInputName($this->model, $this->attribute);
         $value = null;
         if (is_array($this->model->{$this->attribute})) {
             $value = StringHelper::base64EncodeUrl(serialize((array) $this->model->{$this->attribute}));
         } else {
             if (is_string($this->model->{$this->attribute})) {
                 $value = $this->model->{$this->attribute};
             }
         }
         $this->options['id'] = Html::getInputId($this->model, $this->attribute);
         //$element = Html::activeHiddenInput($this->model, $this->attribute, $this->options);
         $element = Html::hiddenInput($name, $value, $this->options);
     } else {
         $element = Html::hiddenInput($this->name, $this->value, $this->options);
     }
     $this->registerPlugin();
     $this->clientOptions['componentSelectId'] = $this->componentSelectId;
     $this->clientOptions['componentSettingsId'] = Html::getInputId($this->model, $this->attribute);
     $this->clientOptions['id'] = $this->id;
     $this->clientOptions['backend'] = UrlHelper::construct('/cms/admin-universal-component-settings/index')->setSystemParam(Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->enableAdmin()->toString();
     return $this->render('element', ['widget' => $this, 'element' => $element]);
 }
开发者ID:skeeks-cms,项目名称:cms,代码行数:28,代码来源:ComponentSettingsWidget.php

示例10: renderInput

 private function renderInput()
 {
     if ($this->hasModel()) {
         return Html::activeHiddenInput($this->model, $this->attribute, $this->options);
     } else {
         return Html::hiddenInput($this->name, $this->value, $this->options);
     }
 }
开发者ID:petrabarus,项目名称:yii2-recaptcha,代码行数:8,代码来源:ReCaptcha.php

示例11: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerAssets();
     if ($this->name === null) {
         return Html::activeHiddenInput($this->model, $this->attribute, $this->options);
     }
     return Html::hiddenInput($this->name, $this->value, $this->options);
 }
开发者ID:cyhalothrin,项目名称:yiiflow,代码行数:11,代码来源:FlowFileInput.php

示例12: renderInput

 /**
  * Renders a text input for widget display along with an internal
  * hidden input to validate and save the raw number (float) data.
  */
 protected function renderInput()
 {
     $name = $this->_displayOptions['id'];
     Html::addCssClass($this->_displayOptions, 'form-control');
     $input = Html::textInput($name, $this->value, $this->_displayOptions);
     $input .= $this->hasModel() ? Html::activeHiddenInput($this->model, $this->attribute, $this->options) : Html::hiddenInput($this->name, $this->value, $this->options);
     echo $input;
 }
开发者ID:tejrajs,项目名称:yii2-money,代码行数:12,代码来源:MaskMoney.php

示例13: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         return Html::activeHiddenInput($this->model, $this->attribute, $this->options);
     } else {
         return Html::hiddenInput($this->name, '', $this->options);
     }
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:11,代码来源:JsCaptcha.php

示例14: renderWidget

 public function renderWidget()
 {
     if ($this->hasModel()) {
         $result = Html::activeHiddenInput($this->model, $this->attribute);
     } else {
         $result = Html::hiddenInput($this->name, $this->value);
     }
 }
开发者ID:jimminababan,项目名称:sangkilbiz3,代码行数:8,代码来源:AutoComplete.php

示例15: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         echo Html::activeHiddenInput($this->model, $this->attribute, ['id' => null]) . Html::activeInput('file', $this->model, $this->attribute, $this->options);
     } else {
         echo Html::hiddenInput($this->name, $this->value, ['id' => null]) . Html::input('file', $this->name, $this->value, $this->options);
     }
 }
开发者ID:cliff363825,项目名称:yii2-uploadify,代码行数:12,代码来源:UploadifyWidget.php


注:本文中的yii\helpers\Html::hiddenInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。