/** * 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); } }
/** * 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); }
/* @var $form yii\widgets\ActiveForm */ ?> <div class="row"> <div class = "col-xs-12 col-sm-10"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'subject', ['template' => '{label} <div class="row"><div class="col-xs-10 col-sm-6 col-lg-4">{input}{error}{hint}</div></div>'])->textInput(['maxlength' => 1024]); ?> <?php echo $form->field($model, 'body')->widget(tinymce\Tinymce::className(), ['configs' => ['plugins' => 'link', 'menu' => []]]); ?> <?php echo Html::checkbox('send', true, ['label' => 'Отправить пользователям']); ?> <?php echo $form->field($model, 'id_tournament', ['template' => '{label} <div class="row"><div class="col-xs-8 col-sm-5 col-md-3">{input}{error}{hint}</div></div>'])->dropDownList($tournaments); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
<!-- <?php echo $form->field($model, 'description_en')->textarea(['rows' => 6]); ?> --> <?php echo $form->field($model, 'description_en')->widget(\letyii\tinymce\Tinymce::className(), ['options' => ['id' => 'testid'], 'configs' => ['link_list' => [['title' => 'My page 1', 'value' => 'http://www.tinymce.com'], ['title' => 'My page 2', 'value' => 'http://www.tinymce.com']]]]); ?> <!-- <?php echo $form->field($model, 'description_ru')->textarea(['rows' => 6]); ?> --> <?php echo $form->field($model, 'description_ru')->widget(\letyii\tinymce\Tinymce::className(), ['options' => ['id' => 'testid'], 'configs' => ['link_list' => [['title' => 'My page 1', 'value' => 'http://www.tinymce.com'], ['title' => 'My page 2', 'value' => 'http://www.tinymce.com']]]]); ?> <?php echo $form->field($model, 'passengers')->textInput(); ?> <?php echo $form->field($model, 'bags')->textInput(); ?> <?php echo $form->field($model, 'internet')->textInput(['maxlength' => true]); ?> <?php