registerJs($js, View::POS_READY);
if (!empty($model->image)) {
$files[] ='
';
$config [] = ["url" => "delete-image", "key" => 0, 'extra' => ['image' => $model->image, 'id' => $model->id]];
} else {
$files = [];
$config = [];
}
?>
['enctype' => 'multipart/form-data']]); ?>
= $form->field($model, 'title')
->textInput([ 'maxlength' => true ]) ?>
'file',
'options' => [
'multiple' => false,
'accept' => 'image/*',
],
'pluginOptions' => [
'maxFileCount' => 1,
'showUpload' => false,
'removeClass' => 'btn btn-danger',
'removeIcon' => '
',
'initialPreview' => $files,
'overwriteInitial' => true,
'initialPreviewConfig' => $config
],
]
) ?>
isNewRecord){
echo $model->author->name.' '.$model->author->secondname;
}else{
echo $form->field($model, 'author_id')
->widget(
Select2::classname(),
[
'data' => $data,
'pluginOptions' => [
'allowClear' => true,
],
]
);
}
?>
= $form->field($model, 'description')
->widget(
TinyMce::className(),
[
'options' => [ 'rows' => 30 ],
'language' => 'ru',
'clientOptions' => [
'file_browser_callback' => new JsExpression(
"function(field_name, url, type, win) {
window.open('" . Url::to(
[
'imagemanager/manager',
'view-mode' => 'iframe',
'select-type' => 'tinymce',
]
) . "&tag_name='+field_name,'','width=800,height=540 ,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no');
}"
),
'plugins' => [
"advlist autolink lists link charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste image",
],
'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code",
'image_advtab' => true,
],
]
); ?>
= $form->field($model, 'preview')
->textarea(
[
'rows' => '10',
]
) ?>
= $form->field($model, 'status')->widget(
Select2::classname(),
[
'data' => $model->getStatuses(),
'pluginOptions' => [
'allowClear' => true,
],
]
);
?>
= $form->field($model, 'price')
->textInput() ?>
= $form->field($model, 'on_main')
->checkbox(
[
'class' => 'switchery',
]
) ?>
= Html::submitButton(
$model->isNewRecord ? Yii::t('core', 'Create') : Yii::t('core', 'Update'),
[ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
) ?>