/** * Initializes the widget. * If you override this method, make sure you call the parent implementation first. */ public function init() { parent::init(); if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = $this->getId(); } }
/** * Two variants to editing * * @param boolean $light * @param array $options * @return array */ public static function editorField($light = true, $options = []) { if ($light) { return ArrayHelper::merge(['type' => Form::INPUT_WIDGET, 'widgetClass' => Widget::className()], $options); } else { return ArrayHelper::merge(['type' => Form::INPUT_WIDGET, 'widgetClass' => Tinymce::className()], $options); } }
public function run() { $modelId = $this->model->isNewRecord ? uniqid() : $this->model->getId(); $this->options = array_merge($this->_options, $this->options); $this->options['toolbarFixed'] = true; $this->options['toolbarFixedTarget'] = '#' . $this->htmlOptions['id']; $this->htmlOptions = array_merge($this->_htmlOptions, $this->htmlOptions); $buttonParam = isset($this->options['airButtons']) && $this->options['airButtons'] == true ? 'airButtons' : 'buttons'; $this->plugins = ['fullscreen', 'fontcolor', 'fontsize']; switch ($this->toolbarSize) { case 'full': $this->options[$buttonParam] = ['html', 'formatting', '|', 'bold', 'italic', 'underline', 'deleted', 'fontsize', 'fontcolor', 'backcolor', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'video', 'file', 'table', 'link', 'alignment', 'horizontalrule']; break; case 'medium': $this->options[$buttonParam] = ['bold', 'italic', 'underline', 'deleted', 'fontsize', 'fontcolor', 'backcolor', '|', 'unorderedlist', 'orderedlist', '|', 'image', 'video', 'file', 'table', 'link']; break; default: $this->options[$buttonParam] = ['bold', 'italic', 'underline', 'deleted', 'link']; break; } switch ($this->size) { case 'full': $this->htmlOptions['style'] = "height: 100%"; break; case 'large': $this->htmlOptions['rows'] = 12; break; case 'medium': $this->htmlOptions['rows'] = 6; break; default: $this->htmlOptions['rows'] = 3; break; } if ($this->enableFiles) { array_push($this->plugins, 'imagemanager', 'filemanager'); $this->options['imageUpload'] = ArrayHelper::getValue($this->options, 'imageUpload', '/image/save/' . $this->model->isWHat() . '/' . $modelId); $this->options['imageManagerJson'] = json_encode(array_map(function ($image) { if (is_array($image)) { return ['thumb' => $image['metadata']['thumb'], 'image' => $image['url'], 'title' => $image['title']]; } }, (array) \nitm\filemanager\models\Image::getImagesFor($this->model, true)->asArray()->all())); $this->options['fileUpload'] = ArrayHelper::getValue($this->options, 'fileUpload', '/file/save/' . $this->model->isWHat() . '/' . $modelId); $this->options['fileManagerJson'] = json_encode(array_map(function ($file) { if (is_array($file)) { return ['name' => $file['metadata']['thumb'], 'image' => $file['url'], 'name' => $file['file_name'], 'title' => $file['title'], 'size' => \Yii::$app->formatter->asShortSize($file['size'])]; } }, (array) \nitm\filemanager\models\File::getFilesFor($this->model, true)->asArray()->all())); } $this->htmlOptions['role'] = $this->role; return parent::run() . \yii\helpers\Html::style("#redactor_modal_overlay, #redactor_modal, .redactor_dropdown {z-index: 10000 !important;}"); }
?> <?php echo $form->field($model, 'image')->widget(\trntv\filekit\widget\Upload::className(), ['url' => ['/file-storage/upload']]); ?> <?php echo $form->field($model, 'order')->textInput(); ?> <?php echo $form->field($model, 'url')->textInput(['maxlength' => 1024]); ?> <?php echo $form->field($model, 'caption')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video'], 'options' => ['minHeight' => 400, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false]]); ?> <?php echo $form->field($model, 'status')->checkbox(); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
/** * Two editor row * * @param $name * @param bool $editable * @param bool $light * @param array $options * @return array */ public static function editorRow($name, $editable = true, $light = true, $options = []) { $row = []; $row['attribute'] = $name; if ($editable) { $row['format'] = 'html'; $row['type'] = DetailView::INPUT_WIDGET; $row['widgetOptions'] = []; if ($light) { $row['widgetOptions']['class'] = Widget::className(); } else { $row['widgetOptions']['class'] = Tinymce::className(); } } else { $row['displayOnly'] = true; } return ArrayHelper::merge($row, $options); }
'-', array('Blockquote'), ), 'skin' => $this->module->editorSkin, 'uiColor' => $this->module->editorUIColor, 'contentsCss' => $this->module->editorContentsCss, ));*/ ?> <?php //echo $form->field($model, 'content')->textArea(['rows' => '6']); ?> <?php // echo $form->error($model,'content'); ?> <?php echo $form->field($model, 'content')->widget(\yii\imperavi\Widget::className(), ['options' => ['buttonSource' => true, 'convertDivs' => true, 'removeEmptyTags' => true, 'name' => 'content']]); ?> </div> </div> <div class = "row buttons"> <div class="col col-md-12"> <?php echo $form->field($model, 'type')->input('hidden')->label(false); ?> <?php echo Html::submitButton(Yii::t('BbiiModule.bbii', 'Send'), array('class' => 'btn btn-success btn-lg')); ?> </div> </div>
// echo Select2::widget([ // 'name' => 'color_1', // 'options' => ['placeholder' => 'Select a color ...'], // 'pluginOptions' => [ // 'tags' => ["red", "green", "blue", "orange", "white", "black", "purple", "cyan", "teal"], // 'maximumInputLength' => 10 // ], // ]); } elseif ($child->type == 'redactor') { $options = []; $arrayOptions = explode('|', $child->store_range); foreach ($arrayOptions as $option) { $options[$option] = $option; } \itzen\setting\RedactorPlugins::register($this); $str .= '<div class="row"><div class="col-lg-8">' . \yii\imperavi\Widget::widget(['id' => \yii\helpers\Inflector::slug($child->code), 'attribute' => "Setting[{$child->code}]", 'value' => $child->value, 'plugins' => ['fullscreen', 'imagemanager', 'table', 'fontsize', 'fontcolor', 'customColors'], 'options' => ['minHeight' => 400, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'replaceDivs' => false, 'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi']), 'imageManagerJson' => '/file-storage/index-json', 'clipboardUpload' => true, 'clipboardUploadUrl' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])]]) . '</div>'; $str .= '<div class="col-lg-4"><div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">' . Module::t('setting', 'Clips') . '</h3> </div> <div class="panel-body">' . Html::dropDownList("clips", '', $options, ["class" => "form-control insert-clip " . \yii\helpers\Inflector::slug($child->code)]) . Html::button(Module::t('setting', 'Insert clip'), ["class" => "form-control insert-clip-btn", 'data-redactor-id' => \yii\helpers\Inflector::slug($child->code)]) . '</div></div> </div></div>'; } $str .= '</div></div>'; } $item['content'] = $str; array_push($items, $item); } ?> <?php
?> <div class="form-group field-setting-<?php echo $index; ?> -value"> <label class="control-label col-sm-4" for="setting-<?php echo $index; ?> -value"> <?php echo $setting->defineEncoded(); ?> </label> <div class="col-sm-8"> <?php echo ImperaviWidget::widget(['attribute' => "Setting[{$index}][value]", 'value' => $setting->value, 'options' => ['buttons' => $setting->redactorOptions(), 'buttonSource' => true, 'minHeight' => 300, 'autoresize' => true, 'imageUpload' => Yii::$app->urlManagerFrontend->createUrl(['media/default/redactor-upload', 'content_id' => $setting->id, 'content_type' => $setting->className()]), 'focus' => true, 'imageManagerJson' => Yii::$app->urlManagerBackend->createUrl(['media/default/list-media', 'content_id' => $setting->id, 'content_type' => $setting->className()])], 'plugins' => []]); ?> </div> </div> <?php } else { if ($setting->type == Setting::TYPE_DROP_DOWN) { echo $form->field($setting, "[{$index}]value")->dropDownList($setting->dropDownOptions())->label($setting->defineEncoded()); } else { echo $form->field($setting, "[{$index}]value")->label($setting->defineEncoded()); } } } } ?> </div>
<div class="page-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'body')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video'], 'options' => ['minHeight' => 400, 'maxHeight' => 400, 'buttonSource' => true, 'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])]]); ?> <?php echo $form->field($model, 'view')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'status')->checkbox(); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
<?php /** * Created with love. * User: BenasPaulikas * Date: 2016-03-30 * Time: 21:59 */ use yii\helpers\Html; use yii\imperavi\Widget; use yii\widgets\ActiveForm; /* @var $model benaspaulikas\forum\models\Post */ $form = ActiveForm::begin(); echo $form->errorSummary($model); if (!isset($comment)) { echo $form->field($model, 'subject')->textInput(['maxlength' => 100]); } $buttons = ['formatting', 'bold', 'italic', 'deleted', 'link', 'orderedlist', 'paragraph']; echo Widget::widget(['model' => $model, 'attribute' => 'content', 'options' => ['imageUpload' => false, 'buttons' => $buttons, 'formatting' => ['p', 'blockquote', 'pre']]]); echo Html::submitButton($model->isNewRecord ? Yii::t('app', isset($comment) ? 'Reply' : 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-u' : 'btn btn-u']); ActiveForm::end();
?> <?php echo $form->field($model, 'guize')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video', 'fontsize'], 'options' => ['lang' => 'zh', 'minHeight' => 150, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])]]); ?> <?php echo $form->field($model, 'jiangli')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video', 'fontsize'], 'options' => ['lang' => 'zh', 'minHeight' => 150, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])]]); ?> <?php echo $form->field($model, 'jiangli_fangfa')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video', 'fontsize'], 'options' => ['lang' => 'zh', 'minHeight' => 150, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])]]); ?> <?php echo $form->field($model, 'content')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video', 'fontsize'], 'options' => ['lang' => 'zh', 'minHeight' => 600, 'maxHeight' => 800, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])]]); ?> <?php echo $form->field($model, 'sort'); ?> <?php echo $form->field($model, 'status')->dropDownList(Activity::getStatus()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
echo $form->field($model, 'slug')->textInput(['maxlength' => true]); ?> </div> <div class="col-md-6"> <?php echo $form->field($model, 'status')->checkbox(); ?> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <?php echo $form->field($model, 'description')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video', 'table', 'fontfamily', 'fontsize', 'textdirection', 'textexpander'], 'options' => ['minHeight' => 400, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])]]); ?> </div> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
/* @var $model yii2mod\cms\models\CmsModel */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="cms-model-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'content')->widget(Widget::className(), ['options' => ['minHeight' => 200, 'replaceDivs' => false, 'formatting' => ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'span'], 'formattingAdd' => [['tag' => 'span', 'title' => 'Color Green', 'class' => 'green'], ['tag' => 'span', 'title' => 'Color Gray', 'class' => 'gray'], ['tag' => 'span', 'title' => 'Font Size 10px', 'class' => 'font-size-10'], ['tag' => 'span', 'title' => 'Font Size 15px', 'class' => 'font-size-15'], ['tag' => 'span', 'title' => 'Font Size 20px', 'class' => 'font-size-20'], ['tag' => 'span', 'title' => 'Font Size 25px', 'class' => 'font-size-25'], ['tag' => 'span', 'title' => 'Font Size 30px', 'class' => 'font-size-30']]], 'id' => 'content']); ?> <?php echo $form->field($model, 'url', ['inputTemplate' => '<div class="input-group"><span class="input-group-addon">' . Yii::$app->urlManager->hostInfo . '/' . '</span>{input}</div>'])->textInput(['maxlength' => 255])->hint('This one accepts only letters, numbers, dash and slash, i.e. "docs/installation".'); ?> <?php echo $form->field($model, 'metaTitle')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'metaDescription')->textarea(['rows' => 6]); ?> <?php
<!-- Confirmation Request Modal --> <div class="modal fade" id="confirmation-check"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">Send Confirmation Request To <span class="num-people"></span> Person(s)</h4> </div> <div class="modal-body"> <div class="form-group"> <label for="message" class="control-label">Message:</label> <?php echo \yii\imperavi\Widget::widget(['attribute' => 'confirmation-message', 'value' => $this->render('_confirmation-check', ['model' => $model]), 'options' => ['minHeight' => 300]]); ?> </div> <div class="form-group"> <label for="message" class="control-label">Attachment:</label> <input type="file" name="confirmation-attachment" class="form-control"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Send Confirmation Request</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
/* @var $model yii2mod\cms\models\CmsModel */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="cms-model-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'content')->widget(Widget::className(), ['plugins' => ['video', 'fullscreen', 'table'], 'options' => ['minHeight' => 200], 'id' => 'content']); ?> <?php echo $form->field($model, 'url', ['inputTemplate' => '<div class="input-group"><span class="input-group-addon">' . Yii::$app->urlManager->hostInfo . '/' . '</span>{input}</div>'])->textInput(['maxlength' => 255])->hint(Yii::t('yii2mod.cms', 'This one accepts only letters, numbers, dash and slash, i.e. "docs/installation".')); ?> <?php echo $form->field($model, 'metaTitle')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'metaDescription')->textarea(['rows' => 6]); ?> <?php
$this->params['breadcrumbs'][] = ['label' => 'Comments Management', 'url' => ['index']]; $this->params['breadcrumbs'][] = 'Update'; ?> <div class="comment-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <div class="comment-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'content')->widget(Widget::className(), ['options' => ['minHeight' => 300, 'replaceDivs' => true, 'paragraphize' => false], 'id' => 'content']); ?> <?php echo $form->field($model, 'status')->dropDownList(CommentStatus::listData()); ?> <div class="form-group"> <?php echo Html::submitButton('Update', ['class' => 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> </div>
echo $form->field($model, 'category_id')->widget(Select2::classname(), ['data' => Category::buildTextTree(), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите категорию ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'producer_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Producer::find()->all(), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите бренд ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-lg-6 col-xs-6"> <?php echo $form->field($model, 'category_ids')->label('Прочие категории')->widget(Select2::classname(), ['data' => Category::buildTextTree(), 'language' => 'ru', 'options' => ['multiple' => true, 'placeholder' => 'Доп. категории ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> </div> <?php echo $form->field($model, 'text')->widget(\yii\imperavi\Widget::className(), ['plugins' => ['fullscreen', 'fontcolor', 'video'], 'options' => ['minHeight' => 400, 'maxHeight' => 400, 'buttonSource' => true, 'imageUpload' => Url::toRoute(['tools/upload-imperavi'])]]); ?> <?php echo $form->field($model, 'short_text')->textInput(['maxlength' => true]); ?> <?php echo Gallery::widget(['model' => $model]); ?> <?php echo SeoForm::widget(['model' => $model, 'form' => $form]); ?> <div class=" panel panel-default">
$this->title = 'Добавление новости'; $breadcrumb = $this->title; } $this->params['breadcrumbs'][] = ['url' => '/news', 'label' => 'Новости']; $this->params['breadcrumbs'][] = $breadcrumb; echo Html::beginTag('div', ['class' => 'col-xs-12']); if (\Yii::$app->session->getFlash('saved', false)) { echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('saved'), 'options' => ['class' => 'alert alert-success alert-dismissible']]); } else { if (\Yii::$app->session->getFlash('error', false)) { echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('error'), 'options' => ['class' => 'alert alert-danger alert-dismissible row col-xs-10 col-xs-offset-1']]); } } echo Html::endTag('div'); $form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]); ?> <div class="panel panel-default"> <div class="panel-heading"> <?php echo $this->render('_news_header_buttons', ['model' => $model, 'mode' => $mode]); ?> </div> <div class="panel-body"> <?php echo Html::tag('div', $form->field($model, 'title') . $form->field($model, 'category')->widget(\kartik\select2\Select2::className(), ['data' => ArrayHelper::map(Category::find()->where(['deleted' => 0])->asArray()->all(), 'id', 'title')]) . $form->field($model, 'link')->hint('Оставьте поле пустым, чтобы ссылку сгенерировала система') . $form->field($model, 'text')->widget(\yii\imperavi\Widget::className(), ['id' => 'textEditor', 'options' => ['lang' => 'ru', 'imageUpload' => '/news/upload', 'imageManagerJson' => '/news/uploaded'], 'plugins' => ['imagemanager', 'video', 'border']]) . $form->field($model, 'metaDescription')->textarea() . $form->field($model, 'metaKeywords') . $form->field($model, 'language')->dropDownList($model->getLanguages()) . $form->field($model, 'publishDate')->widget(\kartik\datetime\DateTimePicker::className(), ['pluginOptions' => ['format' => 'dd.mm.yyyy HH:ii']]) . $form->field($model, 'genre')->dropDownList($model->getGenres()) . $form->field($model, 'author'), ['class' => 'col-xs-12']), $form->field($model, 'published', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'favorite', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'deleted', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'moderatedComments', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), Html::tag('div', Html::button(FontAwesome::i('save') . Html::tag('small', 'сохранить'), ['class' => 'btn btn-app btn-success', 'type' => 'submit']), ['class' => 'text-center']); ?> </div> </div> <?php $form->end(); echo Html::tag('div', '', ['class' => 'clearfix']);
<?php echo \bariew\postAbstractModule\widgets\ImageGallery::widget(['model' => $model, 'field' => 'thumb1']); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'categories')->widget(Select2::className(), ['data' => $model->categoriesList(), 'options' => ['placeholder' => false, 'multiple' => true]]); ?> <?php echo $form->field($model, 'brief')->widget(\yii\imperavi\Widget::className(), ['options' => ['minHeight' => 100, 'fileUpload' => Url::toRoute(['file-upload', 'attr' => 'brief', 'id' => $model->id]), 'imageUpload' => Url::toRoute(['image-upload', 'attr' => 'brief', 'id' => $model->id]), 'imageGetJson' => Url::toRoute(['image-list', 'attr' => 'brief', 'id' => $model->id]), 'imageUploadErrorCallback' => new \yii\web\JsExpression('function(json) { alert(json.error); }'), 'fileUploadErrorCallback' => new \yii\web\JsExpression('function(json) { alert(json.error); }')]]); ?> <?php echo $form->field($model, 'content')->widget(\yii\imperavi\Widget::className(), ['options' => ['minHeight' => 300, 'fileUpload' => Url::toRoute(['file-upload', 'attr' => 'content', 'id' => $model->id]), 'imageUpload' => Url::toRoute(['image-upload', 'attr' => 'content', 'id' => $model->id]), 'imageGetJson' => Url::toRoute(['image-list', 'attr' => 'content', 'id' => $model->id]), 'imageUploadErrorCallback' => new \yii\web\JsExpression('function(json) { alert(json.error); }'), 'fileUploadErrorCallback' => new \yii\web\JsExpression('function(json) { alert(json.error); }')]]); ?> <?php echo $form->field($model, 'status')->dropDownList($model->statusList()); ?> <div class="form-group text-right"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('modules/post', 'Create') : Yii::t('modules/post', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
if (isset(Yii::$app->storage) && Yii::$app->storage instanceof storage\components\StorageInterface) { $options['imageUpload'] = Url::toRoute('image'); } $form = ActiveForm::begin(['layout' => 'horizontal', 'enableClientValidation' => false, 'options' => ['class' => 'page-form']]); ?> <?php echo $form->field($model, 'active')->checkbox(); ?> <?php echo $form->field($model, 'title'); ?> <?php echo $form->field($model, 'content')->widget(\yii\imperavi\Widget::className(), ['options' => $options, 'plugins' => ['fullscreen']]); ?> <div class="form-group"> <div class="col-sm-offset-3 col-sm-6"> <?php echo Html::submitButton(Yii::t('page', 'Save'), ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('page', 'Cancel'), ['index'], ['class' => 'btn btn-default']); ?> </div> </div> <?php ActiveForm::end();