當前位置: 首頁>>代碼示例>>PHP>>正文


PHP InputWidget::init方法代碼示例

本文整理匯總了PHP中yii\widgets\InputWidget::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP InputWidget::init方法的具體用法?PHP InputWidget::init怎麽用?PHP InputWidget::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\widgets\InputWidget的用法示例。


在下文中一共展示了InputWidget::init方法的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: 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

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

示例4: init

 /**
  * 
  * @see \yii\base\Object::init()
  */
 public function init()
 {
     if (isset($this->selector)) {
         $this->name = '';
     }
     parent::init();
 }
開發者ID:raoul2000,項目名稱:yii2-twbsmaxlength-widget,代碼行數:11,代碼來源:TwbsMaxlength.php

示例5: init

 public function init()
 {
     parent::init();
     if (!$this->buttonText) {
         $this->buttonText = \Yii::t('app', 'Setting property');
     }
 }
開發者ID:Liv1020,項目名稱:cms,代碼行數:7,代碼來源:ComponentSettingsWidget.php

示例6: init

 public function init()
 {
     parent::init();
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'editor';
     }
 }
開發者ID:hiscaler,項目名稱:yii2-ueditor,代碼行數:7,代碼來源:UEditor.php

示例7: init

 /**
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     parent::init();
     $this->registerMessages();
     if ($this->maxNumberOfFiles > 1 || $this->multiple) {
         $this->multiple = true;
     }
     if ($this->hasModel()) {
         $this->name = $this->name ?: Html::getInputName($this->model, $this->attribute);
         $this->value = $this->value ?: Html::getAttributeValue($this->model, $this->attribute);
     }
     if (!array_key_exists('name', $this->clientOptions)) {
         $this->clientOptions['name'] = $this->name;
     }
     if ($this->multiple && $this->value && !is_array($this->value)) {
         throw new InvalidParamException('In "multiple" mode, value must be an array.');
     }
     if (!array_key_exists('fileparam', $this->url)) {
         $this->url['fileparam'] = $this->getFileInputName();
     }
     if (!$this->files && $this->value) {
         $this->files = $this->multiple ? $this->value : [$this->value];
     }
     if ($this->files) {
         foreach ($this->files as &$file) {
             if (!isset($file['alias_url']) && is_array($file)) {
                 $option = isset($this->clientOptions['baseUrlAttribute']) ? $this->clientOptions['baseUrlAttribute'] : null;
                 $file['alias_url'] = $option ? isset($file[$option]) ? Yii::getAlias($file[$option]) : null : null;
             }
         }
     }
     $this->clientOptions = ArrayHelper::merge(['url' => Url::to($this->url), 'multiple' => $this->multiple, 'sortable' => $this->sortable, 'maxNumberOfFiles' => $this->maxNumberOfFiles, 'maxFileSize' => $this->maxFileSize, 'minFileSize' => $this->minFileSize, 'acceptFileTypes' => $this->acceptFileTypes, 'files' => $this->files, 'showPreviewFilename' => $this->showPreviewFilename, 'pathAttribute' => 'path', 'baseUrlAttribute' => 'base_url', 'pathAttributeName' => 'path', 'baseUrlAttributeName' => 'base_url', 'messages' => ['maxNumberOfFiles' => Yii::t($this->messagesCategory, 'Maximum number of files exceeded'), 'acceptFileTypes' => Yii::t($this->messagesCategory, 'File type not allowed'), 'maxFileSize' => Yii::t($this->messagesCategory, 'File is too large'), 'minFileSize' => Yii::t($this->messagesCategory, 'File is too small')]], $this->clientOptions);
 }
開發者ID:sonrac,項目名稱:yii2-file-kit,代碼行數:36,代碼來源:Upload.php

示例8: init

 public function init()
 {
     parent::init();
     $this->view = $this->getView();
     AssetBundle::register($this->view);
     $this->cropperOptions = array_merge($this->cropperOptions, $this->defaultCropperOptions);
 }
開發者ID:sadovojav,項目名稱:yii2-image-cutter,代碼行數:7,代碼來源:Cutter.php

示例9: init

 /**
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     parent::init();
     $this->registerMessages();
     if ($this->maxNumberOfFiles > 1) {
         $this->multiple = true;
     }
     if ($this->hasModel()) {
         $this->name = $this->name ?: Html::getInputName($this->model, $this->attribute);
         $this->value = $this->value ?: Html::getAttributeValue($this->model, $this->attribute);
     }
     if (!array_key_exists('name', $this->clientOptions)) {
         $this->clientOptions['name'] = $this->name;
     }
     if ($this->multiple && $this->value && !is_array($this->value)) {
         throw new InvalidParamException('In "multiple" mode, value must be an array.');
     }
     if (!array_key_exists('fileparam', $this->url)) {
         $this->url['fileparam'] = $this->getFileInputName();
     }
     if (!$this->files && $this->value) {
         $this->files = $this->multiple ? $this->value : [$this->value];
     }
     $this->clientOptions = ArrayHelper::merge(['url' => Url::to($this->url), 'multiple' => $this->multiple, 'sortable' => $this->sortable, 'maxNumberOfFiles' => $this->maxNumberOfFiles, 'maxFileSize' => $this->maxFileSize, 'minFileSize' => $this->minFileSize, 'acceptFileTypes' => $this->acceptFileTypes, 'files' => $this->files, 'messages' => ['maxNumberOfFiles' => Yii::t($this->messagesCategory, 'Maximum number of files exceeded', [], 'en'), 'acceptFileTypes' => Yii::t($this->messagesCategory, 'File type not allowed', [], 'en'), 'maxFileSize' => Yii::t($this->messagesCategory, 'File is too large', [], 'en'), 'minFileSize' => Yii::t($this->messagesCategory, 'File is too small', [], 'en')]], $this->clientOptions);
 }
開發者ID:yiioverflow,項目名稱:yii2-file-kit,代碼行數:28,代碼來源:Upload.php

示例10: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->target === null) {
         $this->target = '#' . $this->getId();
     }
 }
開發者ID:Brother-Simon,項目名稱:yii2-wechat,代碼行數:10,代碼來源:FileApiInputWidget.php

示例11: init

 public function init()
 {
     parent::init();
     if ($this->dateFormat === null) {
         $this->dateFormat = Yii::$app->formatter->dateFormat;
     }
 }
開發者ID:omnilight,項目名稱:yii2-bootstrap-datepicker,代碼行數:7,代碼來源:DatePicker.php

示例12: init

 public function init()
 {
     parent::init();
     if ($this->backendUrl === null) {
         $this->backendUrl = UrlHelper::construct('cms/admin-storage-files/link-to-models')->enableAdmin()->toString();
     }
 }
開發者ID:skeeks-cms,項目名稱:cms,代碼行數:7,代碼來源:ModelStorageFiles.php

示例13: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset($this->options['name'])) {
         $this->options['name'] = $this->hasModel() ? Html::getInputName($this->model, $this->attribute) : $this->name;
     }
 }
開發者ID:vetoni,項目名稱:toko,代碼行數:10,代碼來源:Rating.php

示例14: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->selector === null) {
         $this->selector = '#' . $this->options['id'];
     }
 }
開發者ID:pvlg,項目名稱:yii2-bootstrap-datetimepicker-widget,代碼行數:10,代碼來源:DatetimePickerWidget.php

示例15: init

 public function init()
 {
     if (is_null($this->name)) {
         throw new InvalidConfigException('Name property must be specified.');
     }
     parent::init();
     $view = $this->getView();
     JoyrideAsset::register($view);
     if (isset($this->joyride_options['cookieMonster']) && $this->joyride_options['cookieMonster'] === true) {
         $this->publishAndRegisterFile('@vendor/branchonline/yii2-joyride/src/assets/jquery.cookie.js', ['depends' => JoyrideAsset::className()]);
     }
     $joyride_options_strings = [];
     $this->joyride_options['autoStart'] = 'true';
     foreach ($this->joyride_options as $k => $v) {
         if (is_bool($v)) {
             $value = $v ? 'true' : 'false';
         } else {
             $value = "'" . $v . "'";
         }
         $joyride_options_strings[] = $k . ': ' . $value;
     }
     $view->registerJs('console.log($("#' . $this->getId() . '")); $("#' . $this->getId() . '").joyride({
          ' . implode(', ', $joyride_options_strings) . '
     });');
 }
開發者ID:branchonline,項目名稱:yii2-joyride,代碼行數:25,代碼來源:Joyride.php


注:本文中的yii\widgets\InputWidget::init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。