/** * 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); } }
<?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(); ?>
<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>
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">
/* @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
?> <?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>
$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']);
$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>
?> <?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
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();