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


PHP Html::textarea方法代码示例

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


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

示例1: editable

    protected function editable()
    {
        $id = $this->id;
        $autocompletion = $this->autocompletion ? 'true' : 'false';
        if ($this->autocompletion) {
            $this->aceOptions['enableBasicAutocompletion'] = true;
            $this->aceOptions['enableSnippets'] = true;
            $this->aceOptions['enableLiveAutocompletion'] = false;
        }
        $aceOptions = Json::encode($this->aceOptions);
        $this->view->registerJs(<<<JS
(function(){
    if({$autocompletion}) {
        ace.require("ace/ext/language_tools");
    }

    var _editor = ace.edit("{$id}");
    _editor.setTheme("ace/theme/{$this->theme}");
    _editor.getSession().setMode("ace/mode/{$this->mode}");
    _editor.setOptions({$aceOptions});
})();
JS
);
        if ($this->hasModel()) {
            $html = Html::activeTextarea($this->model, $this->attribute, $this->options);
        } else {
            $html = Html::textarea($this->name, $this->value, $this->options);
        }
        return $html;
    }
开发者ID:borales,项目名称:yii2-ace-widget,代码行数:30,代码来源:Widget.php

示例2: run

 public function run()
 {
     Assets::register($this->getView());
     echo Html::beginTag('div', $this->containerOptions);
     if ($this->hasModel()) {
         echo Html::activeTextarea($this->model, $this->attribute, $this->options);
     } else {
         echo Html::textarea($this->name, $this->value, $this->options);
     }
     echo Html::endTag('div');
     $js = ['mihaildev.ckEditor.registerOnChange(' . Json::encode($this->options['id']) . ');'];
     if (isset($this->editorOptions['filebrowserUploadUrl'])) {
         $js[] = "mihaildev.ckEditor.registerCsrf();";
     }
     if (!isset($this->editorOptions['on']['instanceReady'])) {
         $this->editorOptions['on']['instanceReady'] = new JsExpression("function( ev ){" . implode(' ', $js) . "}");
     }
     if ($this->_inline) {
         $JavaScript = "CKEDITOR.inline(";
         $JavaScript .= Json::encode($this->options['id']);
         $JavaScript .= empty($this->editorOptions) ? '' : ', ' . Json::encode($this->editorOptions);
         $JavaScript .= ");";
         $this->getView()->registerJs($JavaScript, View::POS_END);
         $this->getView()->registerCss('#' . $this->containerOptions['id'] . ', #' . $this->containerOptions['id'] . ' .cke_textarea_inline{height: ' . $this->editorOptions['height'] . 'px;}');
     } else {
         $JavaScript = "CKEDITOR.replace(";
         $JavaScript .= Json::encode($this->options['id']);
         $JavaScript .= empty($this->editorOptions) ? '' : ', ' . Json::encode($this->editorOptions);
         $JavaScript .= ");";
         $this->getView()->registerJs($JavaScript, View::POS_END);
     }
 }
开发者ID:vxdiv,项目名称:yii2-ckeditor,代码行数:32,代码来源:CKEditor.php

示例3: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerAssets();
     echo $this->hasModel() ? Html::activeTextarea($this->model, $this->attribute, $this->options) : Html::textarea($this->name, $this->value, $this->options);
     $clientOptions = empty($this->clientOptions) ? null : Json::encode($this->clientOptions);
     $this->getView()->registerJs('jQuery( "#' . $this->options['id'] . '" ).summernote(' . $clientOptions . ');');
 }
开发者ID:germanigortcev,项目名称:yii2-summernote-widget,代码行数:10,代码来源:Summernote.php

示例4: run

 /**
  * рисует виджет
  */
 public function run()
 {
     $this->registerClientScript();
     $attribute = $this->attribute;
     $value = $this->model->{$attribute};
     return Html::textarea($this->fieldName, $value, ['id' => $this->fieldId]);
 }
开发者ID:CAPITALOV,项目名称:capitalov,代码行数:10,代码来源:HtmlContent.php

示例5: renderFields

 private function renderFields()
 {
     $rows = '';
     if (count($this->_config['fieldName'])) {
         foreach ($this->_config['fieldName'] as $ind => $n) {
             $search = [];
             $replace = [];
             $t = $this->_config['fieldType'][$ind];
             $r = $this->_config['fieldRequired'][$ind];
             //$opt = $r ? ['required'=>true] : [];
             $name = 'f' . $ind;
             $label = Html::label($n) . ($r ? $this->_config['tplMarker'] : '');
             $search[] = '{*label*}';
             $replace[] = $label;
             if ($t == 'input') {
                 $opt['maxlength'] = 50;
                 $tpl = 'tplInput';
                 $field = Html::textInput($name, null, $opt);
             } elseif ($t == 'textarea') {
                 $opt['rows'] = 4;
                 $opt['maxlength'] = 500;
                 $tpl = 'tplArea';
                 $field = Html::textarea($name, '', $opt);
             }
             if (strpos($this->_config[$tpl], '{*label*}') === false && $r) {
                 $field .= $this->_config['tplMarker'];
             }
             $search[] = '{*field*}';
             $replace[] = $field;
             $rows .= str_replace($search, $replace, $this->_config[$tpl]) . "\n";
         }
     }
     return $rows;
 }
开发者ID:kintastish,项目名称:mobil,代码行数:34,代码来源:FeedbackFormWidget.php

示例6: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     echo $this->hasModel() ? Html::activeTextarea($this->model, $this->attribute, $this->options) : Html::textarea($this->name, $this->value, $this->options);
     $this->clientOptions['onImageUpload'] = new JsExpression("function(files){summerNoteImgUpload(files[0], '" . $this->options['id'] . "','" . $this->imgServer . "')}");
     $clientOptions = empty($this->clientOptions) ? null : Json::encode($this->clientOptions);
     $this->getView()->registerJs('jQuery( "#' . $this->options['id'] . '" ).summernote(' . $clientOptions . ');');
 }
开发者ID:sea129,项目名称:kbay,代码行数:10,代码来源:SummernoteWidget.php

示例7: set_input_type

 protected function set_input_type($type, $name, $value)
 {
     if (isset($type) && isset($name) && isset($value)) {
         $input = NULL;
         $input_name = $name . '[value]';
         switch ($type) {
             case 'string':
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'integer':
                 $input = Html::input('number', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'text':
                 $input = Html::textarea($input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'boolean':
                 $input = Switchery::widget(['name' => $input_name, 'clientOptions' => ['color' => '#64bd63', 'secondaryColor' => '#dfdfdf', 'jackColor' => '#fff', 'jackSecondaryColor' => null, 'className' => 'switchery', 'disabled' => FALSE, 'disabledOpacity' => 0.5, 'speed' => '0.1s', 'size' => 'default'], 'options' => array_merge(['value' => '1'], $this->has_checked($value))]);
                 break;
             default:
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
         }
         return $input;
     }
     return FALSE;
 }
开发者ID:kdes70,项目名称:hotel.lok,代码行数:26,代码来源:SettingsWidget.php

示例8: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     switch ($this->thema) {
         case 'mini':
             $this->getMiniSetting();
             break;
         case 'full':
             $this->getFullSetting();
             break;
         default:
             $this->getDefaultSetting();
             break;
     }
     //Додаємо поле для редактору та визначаємо ідентифікатор
     if (!isset($this->settings['selector'])) {
         $this->settings['selector'] = '#' . $this->options['id'];
         $this->_textarea = $this->hasModel() ? Html::activeTextarea($this->model, $this->attribute, $this->options) : Html::textarea($this->name, $this->value, $this->options);
     }
     /* Якщо [[options['selector']]] false видаляємо з налаштувань. */
     if (isset($this->settings['selector']) && $this->settings['selector'] === false) {
         unset($this->settings['selector']);
     }
     if (empty($this->language)) {
         $this->language = Yii::$app->language;
     }
     $this->settings = ArrayHelper::merge($this->_defaultSettings, $this->settings);
 }
开发者ID:filamentv,项目名称:yii2-app,代码行数:31,代码来源:Tinymce.php

示例9: init

 public function init()
 {
     parent::init();
     Html::addCssClass($this->htmlOptions, 'custom-dz');
     /** @var Image[] $files */
     $files = Image::find()->where(['and', 'object_id = :objectId', 'object_model_id = :modelId'], [':objectId' => $this->objectId, ':modelId' => $this->modelId])->orderBy(['sort_order' => SORT_ASC])->all();
     /** Image $file */
     foreach ($files as $file) {
         $thumbnail_src = $file->getThumbnail('80x80');
         $this->storedFiles[] = ['id' => $file->id, 'name' => $file->filename, 'file' => $file->file, 'thumbnail' => $thumbnail_src, 'description' => $file->image_description];
     }
     $params = ArrayHelper::merge(isset($this->options['params']) ? $this->options['params'] : [], ['objectId' => $this->objectId, 'modelId' => $this->modelId]);
     $this->sortable = true;
     $this->options = ArrayHelper::merge($this->options, ['acceptedFiles' => 'image/*', 'params' => $params, 'previewTemplate' => '<div class="file-row">
                     ' . Html::input('hidden', 'id[]') . Html::input('hidden', 'file[]') . '
                     <!-- This is used as the file preview template -->
                     <div>
                         <span class="preview"><img style="width: 80px; height: 80px;" data-dz-thumbnail /></span>
                     </div>
                     <div>
                         <p class="name" data-dz-name></p>
                         <div class="dz-error-message"><span data-dz-errormessage></span></div>
                     </div>
                     <div class="description">
                         ' . Html::textarea('description', '', ['style' => 'width: 100%; min-width: 80px; height: 80px;']) . '
                     </div>
                     <div>
                         <p class="size" data-dz-size></p>
                         <div class="dz-progress progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
                           <div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
                         </div>
                         <div class="dz-success-mark"><span>✔</span> OK</div>
                         <div class="dz-error-mark"><span>✘</span> ERROR</div>
                     </div>
                     <div>
                       <button data-dz-remove class="btn btn-danger delete">
                         <i class="fa fa-trash-o"></i>
                         <span>' . Yii::t('app', 'Delete') . '</span>
                       </button>
                     </div>
                   </div>', 'thumbnailWidth' => '80', 'thumbnailHeight' => '80', 'previewsContainer' => "#{$this->id}"]);
     $this->eventHandlers = ['removedfile' => 'function(file) {
             jQuery.get(
                 "' . Url::toRoute($this->removeUrl) . '",
                 {
                     "id" : jQuery(file.previewElement).find("[name=\\"id[]\\"]").val(),
                     "filename" : jQuery(file.previewElement).data("filename")
                 }
             ).done(function (data) { return data });
         }', 'success' => 'function(file, response) {
             response = jQuery.parseJSON(response);
             jQuery(file.previewElement).find("[data-dz-name]").text(response.filename);
             jQuery(file.previewElement).data("filename", response.filename);
             jQuery(file.previewElement).find("[name=\\"id[]\\"]").val(response.afterUpload.id);
             jQuery(file.previewElement).find("[name=\\"file[]\\"]").val(response.afterUpload.file);
             jQuery(file.previewElement).find(".description textarea").attr("name", "description["+response.afterUpload.id+"]");
         }', 'complete' => 'function(file) {
             jQuery(file.previewElement).removeClass("dz-processing");
         }'];
 }
开发者ID:heartshare,项目名称:dotplant2,代码行数:60,代码来源:ImageDropzone.php

示例10: editable

    protected function editable()
    {
        $id = $this->id;
        $autocompletion = $this->autocompletion ? 'true' : 'false';
        if ($this->autocompletion) {
            $this->aceOptions['enableBasicAutocompletion'] = true;
            $this->aceOptions['enableSnippets'] = true;
            $this->aceOptions['enableLiveAutocompletion'] = false;
        }
        $aceOptions = Json::encode($this->aceOptions);
        $js = <<<JS
(function(){
    var aceEditorAutocompletion = {$autocompletion};

    if (aceEditorAutocompletion) {
        ace.require("ace/ext/language_tools");
    }

    {$this->varNameAceEditor} = ace.edit("{$id}");
    {$this->varNameAceEditor}.setTheme("ace/theme/{$this->theme}");
    {$this->varNameAceEditor}.getSession().setMode("ace/mode/{$this->mode}");
    {$this->varNameAceEditor}.setOptions({$aceOptions});
})();
JS;
        $view = $this->getView();
        $view->registerJs("\nvar {$this->varNameAceEditor} = {};\n", $view::POS_HEAD);
        $view->registerJs($js);
        if ($this->hasModel()) {
            return Html::activeTextarea($this->model, $this->attribute, $this->options);
        }
        return Html::textarea($this->name, $this->value, $this->options);
    }
开发者ID:wbraganca,项目名称:yii2-ace-widget,代码行数:32,代码来源:AceEditorWidget.php

示例11: run

 public function run()
 {
     if ($this->hasModel()) {
         echo Html::activeTextarea($this->model, $this->attribute, $this->options);
     } else {
         echo Html::textarea($this->name, $this->value, $this->options);
     }
 }
开发者ID:himiklab,项目名称:yii2-ckeditor-widget,代码行数:8,代码来源:CKEditor.php

示例12: run

 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         return Html::activeTextarea($this->model, $this->attribute, ['id' => $this->id]);
     } else {
         return Html::textarea($this->id, $this->value, ['id' => $this->id]);
     }
 }
开发者ID:h1cms,项目名称:h1cms-ueditor,代码行数:9,代码来源:Ueditor.php

示例13: run

 public function run()
 {
     Autogrow::widget(['selector' => '#' . $this->options['id']]);
     if ($this->hasModel()) {
         return Html::activeTextarea($this->model, $this->attribute, $this->options);
     } else {
         return Html::textarea($this->name, $this->value, $this->options);
     }
 }
开发者ID:moonlandsoft,项目名称:autogrow,代码行数:9,代码来源:AutogrowInput.php

示例14: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         $content = Html::activeTextarea($this->model, $this->attribute, $this->options);
     } else {
         $content = Html::textarea($this->name, $this->value, $this->options);
     }
     return $content;
 }
开发者ID:andreosoft,项目名称:yii2-codemirror-widget,代码行数:12,代码来源:Codemirror.php

示例15: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         echo Html::activeTextarea($this->model, $this->attribute, $this->options);
     } else {
         echo Html::textarea($this->name, $this->value, $this->options);
     }
 }
开发者ID:cliff363825,项目名称:yii2-kindeditor,代码行数:12,代码来源:KindEditorWidget.php


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