Example #1
0
<div class="list-group-item">

    <?php 
$form = ActiveForm::begin(['fieldConfig' => ['template' => "{input}\n{hint}\n{error}"]]);
?>

    <?php 
echo $form->errorSummary($model, ['class' => 'alert alert-danger']);
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 255, 'placeholder' => '标题']);
?>

    <?php 
echo $form->field($model, 'post_meta_id')->widget(Select2::classname(), ['data' => \common\models\PostMeta::topicCategory(), 'options' => ['placeholder' => '选择一个分类'], 'pluginOptions' => ['allowClear' => true, 'height' => '343%']]);
?>

    <?php 
echo $this->render('@frontend/views/partials/markdwon_help');
?>

    <div class="form-group" id="editor">
        <?php 
echo $form->field($model, 'content')->widget('trntv\\aceeditor\\AceEditor', ['id' => 'markdown', 'mode' => 'markdown', 'containerOptions' => ['style' => 'width: 100%; min-height: 350px'], 'theme' => 'github']);
?>
    </div>

    <?php 
echo SelectizeTextInput::widget(['name' => 'Topic[tags]', 'value' => $model->tags, 'loadUrl' => ['/post-tag/index'], 'clientOptions' => ['placeholder' => '标签(可选)', 'allowEmptyOption' => false, 'delimiter' => ',', 'valueField' => 'name', 'labelField' => 'name', 'searchField' => 'name', 'maxItems' => 5, 'plugins' => ['remove_button'], 'persist' => false, 'create' => true]]);
?>
Example #2
0
<div class="list-group-item">

    <?php 
$form = ActiveForm::begin(['fieldConfig' => ['template' => "{input}\n{hint}\n{error}"]]);
?>

    <?php 
echo $form->errorSummary($model, ['class' => 'alert alert-danger']);
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 255, 'placeholder' => '标题']);
?>

    <?php 
echo $form->field($model, 'post_meta_id')->dropDownList(\common\models\PostMeta::topicCategory(), ['prompt' => '选择一个分类']);
?>

    <?php 
echo $this->render('@frontend/views/partials/markdwon_help');
?>

    <?php 
echo $form->field($model, 'content', ['selectors' => ['input' => '#md-input']])->textarea(['placeholder' => '内容', 'id' => 'md-input', 'rows' => 10]);
?>

    <?php 
echo SelectizeTextInput::widget(['name' => 'Topic[tags]', 'value' => $model->tags, 'loadUrl' => ['/post-tag/index'], 'clientOptions' => ['placeholder' => '标签(可选)', 'allowEmptyOption' => false, 'delimiter' => ',', 'valueField' => 'name', 'labelField' => 'name', 'searchField' => 'name', 'maxItems' => 5, 'plugins' => ['remove_button'], 'persist' => false, 'create' => true]]);
?>

    <div class="form-group">