本文整理汇总了PHP中yii\helpers\Html::activeTextarea方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::activeTextarea方法的具体用法?PHP Html::activeTextarea怎么用?PHP Html::activeTextarea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::activeTextarea方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 = ['bajadev.ckEditor.registerOnChange(' . Json::encode($this->options['id']) . ');'];
if (isset($this->editorOptions['filebrowserUploadUrl'])) {
$js[] = "bajadev.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);
}
}
示例2: 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);
}
示例3: 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);
}
示例4: 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;
}
示例5: run
public function run()
{
$this->autoSavePath .= $this->parentType . '/' . $this->parentId;
$this->options['id'] .= $this->parentId;
$this->widgetOptions['id'] .= $this->parentId;
switch ($this->_enableRevisions) {
case true:
$this->revisionsModel->setScenario('validateNew');
$revisionOptions = ['role' => $this->options['role'], 'id' => $this->options['id'] . $this->parentId, 'data-dave-path' => $this->autoSavePath, 'data-use-redactor' => $this->enableRedactor];
Asset::register($this->getView());
break;
default:
$revisionOptions = [];
break;
}
switch ($this->enableRedactor) {
case true:
$this->editorOptions['id'] = 'message' . uniqid();
$this->editorOptions['model'] = $this->model;
$this->editorOptions['attribute'] = $this->name;
$this->editorOptions['options']['value'] = $this->value;
$input = Editor::widget($this->editorOptions);
break;
default:
$input = Html::activeTextarea($this->model, $this->name, $revisionOption);
break;
}
$result = Html::tag('div', '', ['role' => 'revisionStatus']);
echo Html::tag('div', $input . $result, $this->widgetOptions);
}
示例6: 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 . ');');
}
示例7: 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 . ');');
}
示例8: run
public function run()
{
$this->tagOptions['data-input'] = '#' . $this->options['id'];
$this->options['style'] = 'display: none;';
$this->registerClientScripts();
echo Html::tag('div', Html::getAttributeValue($this->model, $this->attribute), $this->tagOptions);
echo Html::activeTextarea($this->model, $this->attribute, $this->options);
}
示例9: 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);
}
}
示例10: getInputField
/**
* @param string $attribute
*
* @return string
*/
public function getInputField($attribute)
{
if ($this->inputType == 'textArea') {
return Html::activeTextarea($this->model, $attribute, $this->inputOptions);
} else {
return Html::activeTextInput($this->model, $attribute, $this->inputOptions);
}
}
示例11: renderInput
/**
* Renders the widget.
*/
public function renderInput()
{
Html::addCssClass($this->_displayOptions, 'element-' . $this->options['id']);
Html::addCssClass($this->_displayOptions, 'form-control');
$this->_displayOptions['rows'] = 1;
$input = Html::activeTextarea($this->model, $this->attribute, $this->_displayOptions);
echo $input;
}
示例12: run
public function run()
{
BootstrapMarkdownAsset::register($this->view);
$this->view->registerJs('
var markdown=$("#markdown-textarea").markdown({autofocus:true});
');
return Html::activeTextarea($this->model, $this->attribute, $this->options);
}
示例13: 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]);
}
}
示例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;
}
示例15: 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);
}
}