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


PHP Html::getInputId方法代码示例

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


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

示例1: init

 public function init()
 {
     $this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->id;
     $this->_options = ['serverUrl' => Url::to(['upload']), 'initialFrameWidth' => '100%', 'initialFrameHeight' => '300', 'lang' => strtolower(Yii::$app->language) == 'en-us' ? 'en' : 'zh-cn'];
     $this->clientOptions = ArrayHelper::merge($this->_options, $this->clientOptions);
     parent::init();
 }
开发者ID:h1cms,项目名称:h1cms-ueditor,代码行数:7,代码来源:Ueditor.php

示例2: renderFileContent

 public function renderFileContent()
 {
     $attribute = $this->attribute;
     $input = $thumb = '';
     $selectedFileOpt = ['class' => 'fm-browse-input'];
     if ($this->model->{$attribute}) {
         $filesModel = \Yii::$app->getModule('filemanager')->models['files'];
         $file = $filesModel::findOne(['file_identifier' => $this->model->{$attribute}]);
     }
     if (isset($file) && $file) {
         $fileType = $file->mime_type;
         if ($file->dimension) {
             $src = $file->object_url . $file->thumbnail_name;
             $fileType = 'image';
         } else {
             $src = $file->object_url . $file->src_file_name;
         }
         $gridBox = new \dpodium\filemanager\components\GridBox(['owner' => $this, 'src' => $src, 'fileType' => $fileType, 'toolArray' => [['tagType' => 'i', 'options' => ['class' => 'fa-icon fa fa-times fm-remove', 'title' => Yii::t('filemanager', 'Remove')]]], 'thumbnailSize' => \Yii::$app->getModule('filemanager')->thumbnailSize]);
         foreach ($this->fileData as $attribute) {
             $value = isset($file->{$attribute}) ? $file->{$attribute} : null;
             $input .= Html::input('input', "Filemanager[{$attribute}]", $value);
         }
         $thumb = $gridBox->renderGridBox();
     } else {
         $selectedFileOpt['value'] = '';
     }
     $fileView = Html::tag('div', $thumb, ['class' => 'fm-browse-selected-view']);
     $selectedFile = Html::activeInput('input', $this->model, $this->attribute, $selectedFileOpt);
     $buttonClass = empty($this->options['class']) ? 'btn btn-primary' : $this->options['class'];
     $browseButton = Html::label(Yii::t('filemanager', 'Browse'), Html::getInputId($this->model, $this->attribute), ['class' => 'fm-btn-browse btn-browse ' . $buttonClass, 'data-url' => Url::to(['/filemanager/files/browse']), 'data-backdrop' => 'static', 'data-toggle' => 'modal', 'data-target' => '#fm-modal']);
     return $fileView . $browseButton . $selectedFile . $input;
 }
开发者ID:dpodium,项目名称:yii2-filemanager-aws2,代码行数:32,代码来源:FileBrowse.php

示例3: init

 /**
  * Initializes the widget.
  * If you override this method, make sure you call the parent implementation first.
  */
 public function init()
 {
     if ($this->hasModel() && !isset($this->options['id'])) {
         $this->options['id'] = Html::getInputId($this->model, $this->attribute);
     }
     parent::init();
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:11,代码来源:InputWidget.php

示例4: run

 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]);
 }
开发者ID:pigochu,项目名称:yii2-jquery-locationpicker,代码行数:34,代码来源:CoordinatesPicker.php

示例5: 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

示例6: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->clientOptions = array_merge_recursive(self::$defaultSettings, $this->clientOptions);
     $this->clientOptions['extended_valid_elements'] = implode(',', $this->clientOptions['extended_valid_elements']);
     if ($this->hasModel()) {
         $this->options['name'] = isset($this->options['name']) ? $this->options['name'] : Html::getInputName($this->model, $this->attribute);
         if (isset($this->options['value'])) {
             $value = $this->options['value'];
             unset($this->options['value']);
         } else {
             $value = Html::getAttributeValue($this->model, $this->attribute);
         }
         if (!array_key_exists('id', $this->options)) {
             $this->options['id'] = Html::getInputId($this->model, $this->attribute);
         }
     } else {
         $options['name'] = $this->name;
         $value = $this->value;
     }
     if (!isset($this->options['class'])) {
         $this->options['class'] = 'tinymce';
     }
     echo Html::tag('div', $value, $this->options);
     $this->registerClientScript();
 }
开发者ID:comradepashka,项目名称:yii2-tinymce,代码行数:28,代码来源:TinyMce.php

示例7: init

 public function init()
 {
     $this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->id;
     $this->_options = ['serverUrl' => Url::to(['upload']), 'initialFrameWidth' => '100%', 'initialFrameHeight' => '400', 'toolbars' => [['fullscreen', 'source', 'undo', 'redo', 'removeformat', 'lineheight', 'indent', 'simpleupload']], 'lang' => strtolower(Yii::$app->language) == 'en-us' ? 'en' : 'zh-cn'];
     $this->clientConfig = count($this->clientConfig) > 0 ? ArrayHelper::merge($this->_options, $this->clientConfig) : $this->_options;
     parent::init();
 }
开发者ID:xinyeweb,项目名称:yii2-ueditor,代码行数:7,代码来源:UEditor.php

示例8: init

 public function init()
 {
     $this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->id;
     $this->_init = ['serverUrl' => Url::to(['upload']), 'lang' => strtolower(\Yii::$app->language) == 'en-us' ? 'en' : 'zh-cn'];
     $this->options = ArrayHelper::merge($this->_init, $this->options);
     //parent::init();
 }
开发者ID:tqsq2005,项目名称:yii2-ueditor,代码行数:7,代码来源:Ueditor.php

示例9: init

 public function init()
 {
     $id = $this->getId();
     $buttonId = 'fm-btn-' . $id;
     $this->fileManager = ArrayHelper::merge(['controller' => Adm::getInstance()->id . '/elfinder', 'filter' => 'image', 'template' => '<div class="input-group fm-input-cont"><span class="input-group-addon">{button}</span>{input}</div>', 'options' => ['class' => 'form-control'], 'buttonTag' => 'a', 'buttonName' => '', 'buttonOptions' => ['class' => 'glyphicon glyphicon-folder-open filemanager-btn', 'href' => 'javascript:void(0);', 'id' => $buttonId, 'data' => ['placement' => 'top']], 'multiple' => true], $this->fileManager);
     if ($this->enablePreview) {
         $basePath = Yii::getAlias($this->basePath);
         $this->getView()->registerJs('
         $("#' . $buttonId . '").tooltip({
             html: true,
             title: function(){
                 var v = $(this).closest(".fm-input-cont").find("#' . Html::getInputId($this->model, $this->attribute) . '").val();
                 var $img = $("<img src=\\"' . $basePath . '" + v + "\\" class=\\"hide file-input-img\\">");
                 var $loading = $("<span class=\\"file-input-loading fa fa-spinner rotating\\"></span>");
                 $img.on("load", function(){
                     $img.removeClass("hide");
                     $loading.hide();
                 })
                 return $("<div class=\\"file-input-cont\\"><div>").append($loading).append($img);
             },
         });
     ');
     }
     parent::init();
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:25,代码来源:FileInput.php

示例10: run

 public function run()
 {
     if (!$this->hasModel() || !$this->attribute) {
         throw new InvalidConfigException('Fuzzydate DatePicker must have model and attribute.');
     }
     $view = $this->getView();
     $asset = new DatePickerAsset();
     $asset->register($view);
     $view->registerJs("fuzzyReg();");
     $id = Html::getInputId($this->model, $this->attribute);
     $val = Html::getAttributeValue($this->model, $this->attribute);
     if ($val && is_array($val)) {
         $y = $val['y'];
         if ($y) {
             $m = $val['m'];
             if (!$m) {
                 $m = 'null';
             }
             $d = $val['d'];
             if (!$d) {
                 $d = 'null';
             }
             // Call this after initializing jQuery-objects
             $view->registerJs("fuzzySet('{$id}', {$y}, {$m}, {$d});", View::POS_LOAD);
         }
     }
     if (!$this->minYear) {
         $this->minYear = date('Y');
     }
     if (!$this->maxYear) {
         $this->maxYear = date('Y');
     }
     $widget = $this->getViewPath() . DIRECTORY_SEPARATOR . 'datePicker.php';
     echo $view->renderFile($widget, ['widget' => $this]);
 }
开发者ID:sjaakp,项目名称:yii2-fuzzydate,代码行数:35,代码来源:DatePicker.php

示例11: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     if (empty($this->id)) {
         $this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
     }
     if (empty($this->name)) {
         $this->name = $this->hasModel() ? Html::getInputName($this->model, $this->attribute) : $this->id;
     }
     if (empty($this->value) && $this->hasModel() && $this->model->hasAttribute($this->attribute)) {
         $this->value = $this->model->getAttribute($this->attribute);
     }
     if (!$this->autoHeightEnable) {
         if (empty($this->width)) {
             $this->width = '100%';
         }
         if (empty($this->height)) {
             $this->height = '350';
         }
     }
     $options = ['id' => $this->id, 'style' => 'width:100%;height:350px'];
     $this->options = array_merge($options, $this->options);
     $jsOptions = ['serverUrl' => Url::to(['ueditor', 'type' => 'ueditor']), 'autoHeightEnable' => $this->autoHeightEnable, 'autoFloatEnable' => true, 'textarea' => $this->name];
     $this->jsOptions = array_merge($jsOptions, $this->jsOptions);
 }
开发者ID:crazyfd,项目名称:yii2-ueditor,代码行数:28,代码来源:Ueditor.php

示例12: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->name === null && !$this->hasModel() && $this->selector === null) {
         throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
     }
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
     }
     if (!empty($this->defaultSettings)) {
         $this->settings = ArrayHelper::merge($this->defaultSettings, $this->settings);
     }
     if (isset($this->settings['plugins']) && (!is_array($this->settings['plugins']) || !is_array($this->plugins))) {
         throw new InvalidConfigException('The "plugins" property must be an array.');
     }
     if (!isset($this->settings['lang']) && Yii::$app->language !== 'en-US') {
         $this->settings['lang'] = substr(Yii::$app->language, 0, 2);
     }
     if ($this->selector === null) {
         $this->selector = '#' . $this->options['id'];
     } else {
         $this->_renderTextarea = false;
     }
     // @codeCoverageIgnoreStart
     $request = Yii::$app->getRequest();
     if ($request->enableCsrfValidation) {
         $this->settings['uploadImageFields'][$request->csrfParam] = $request->getCsrfToken();
         $this->settings['uploadFileFields'][$request->csrfParam] = $request->getCsrfToken();
     }
     // @codeCoverageIgnoreEnd
     parent::init();
 }
开发者ID:mistim,项目名称:yii2-theme-adminlte,代码行数:34,代码来源:Widget.php

示例13: renderDropDownList

 private function renderDropDownList($data, $value = null)
 {
     if (!count($data)) {
         return;
     }
     return Select2::widget(['id' => md5(Html::getInputId($this->model, $this->attribute) . mt_rand(0, 999999999) . mt_rand(0, 999999999)), 'name' => '', 'value' => $value, 'data' => array_merge([0 => '...'], $data), 'language' => 'ru']);
 }
开发者ID:ejen,项目名称:yii2-fias,代码行数:7,代码来源:FiasSelector.php

示例14: 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

示例15: init

 public function init()
 {
     parent::init();
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
     }
 }
开发者ID:nguyentuansieu,项目名称:OneCMS,代码行数:7,代码来源:DateTimePicker.php


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