update editor at document template form
This commit is contained in:
parent
ac49e3ccf1
commit
1f349aec84
@ -3,6 +3,7 @@
|
|||||||
use asmoday74\ckeditor5\EditorClassic;
|
use asmoday74\ckeditor5\EditorClassic;
|
||||||
use backend\modules\document\models\DocumentField;
|
use backend\modules\document\models\DocumentField;
|
||||||
use common\helpers\StatusHelper;
|
use common\helpers\StatusHelper;
|
||||||
|
use mihaildev\ckeditor\CKEditor;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\ActiveForm;
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
@ -26,10 +27,17 @@ use yii\widgets\ActiveForm;
|
|||||||
]
|
]
|
||||||
) ?>
|
) ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'template_body')->widget(EditorClassic::className(), [
|
<!-- --><?//= $form->field($model, 'template_body')->widget(EditorClassic::className(), [
|
||||||
'clientOptions' => [
|
// 'clientOptions' => [
|
||||||
'language' => 'ru',
|
// 'language' => 'ru',
|
||||||
]
|
// ]
|
||||||
|
// ]); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'template_body')->widget(CKEditor::className(),[
|
||||||
|
'editorOptions' => [
|
||||||
|
'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
|
||||||
|
'inline' => false, //по умолчанию false
|
||||||
|
],
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -68,9 +68,9 @@ class Document extends \yii\db\ActiveRecord
|
|||||||
[['manager_id'], 'exist', 'skipOnError' => true, 'targetClass' => Manager::className(), 'targetAttribute' => ['manager_id' => 'id']],
|
[['manager_id'], 'exist', 'skipOnError' => true, 'targetClass' => Manager::className(), 'targetAttribute' => ['manager_id' => 'id']],
|
||||||
['body', 'required', 'on' => self::SCENARIO_UPDATE_DOCUMENT_BODY],
|
['body', 'required', 'on' => self::SCENARIO_UPDATE_DOCUMENT_BODY],
|
||||||
['body', function ($attribute, $params) {
|
['body', function ($attribute, $params) {
|
||||||
preg_match_all('/(\${\w+})/', $this->$attribute,$out);
|
preg_match_all('/(\${\w+|№|№+w})/', $this->$attribute,$out);
|
||||||
if (!empty($out[0])) {
|
if (!empty($out[0])) {
|
||||||
$this->addError('body', 'В теле документа все переменные должны бвть заменены!');
|
$this->addError('body', 'В теле документа все переменные должны быть заменены!');
|
||||||
}
|
}
|
||||||
}, 'on' => self::SCENARIO_DOWNLOAD_DOCUMENT
|
}, 'on' => self::SCENARIO_DOWNLOAD_DOCUMENT
|
||||||
],
|
],
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
"kartik-v/yii2-widget-depdrop": "dev-master",
|
"kartik-v/yii2-widget-depdrop": "dev-master",
|
||||||
"phpoffice/phpword": "^0.18.2",
|
"phpoffice/phpword": "^0.18.2",
|
||||||
"kartik-v/yii2-widget-fileinput": "@dev",
|
"kartik-v/yii2-widget-fileinput": "@dev",
|
||||||
"kartik-v/yii2-mpdf": "dev-master"
|
"kartik-v/yii2-mpdf": "dev-master",
|
||||||
|
"mihaildev/yii2-ckeditor": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"yiisoft/yii2-debug": "~2.0.0",
|
"yiisoft/yii2-debug": "~2.0.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user