PHP - Summernote con yii2 no inserta el mensaje.

 
Vista:
Imágen de perfil de Claudio
Val: 28
Ha aumentado su posición en 8 puestos en PHP (en relación al último mes)
Gráfica de PHP

Summernote con yii2 no inserta el mensaje.

Publicado por Claudio (70 intervenciones) el 09/02/2019 14:15:45
Hola que tal.

Estoy trabajando con yii2 y tengo un apartado de noticias en el cual he integrado marqu3s\summernote, y tengo 2 inconvenientes.

1.- No inserta la noticia en la base de datos.
2.- No se despliegan los botones Style, Font Family, More Color, Paragraph y Table. Osea ninguno de los botones desplegables

Vista _form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
 
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use marqu3s\summernote\Summernote;
// use marqu3s\summernote\SummernoteAsset;
// use marqu3s\summernote\SummernoteLanguageAsset;
 
/* @var $this yii\web\View */
/* @var $model app\models\Noticias */
/* @var $form yii\widgets\ActiveForm */
?>
 
<div class="contenido-admin">
 
    <?php $form = ActiveForm::begin(); ?>
 
    <?= $form->field($model, 'titulo')->textInput(['maxlength' => true]) ?>
 
    <?= Summernote::widget([
	'name' => 'noticia',
        'clientOptions' => [
            'id' => 'noticia-summernote',
            'toolbar' => [
                ['lang:', 'es-ES'],
                ['style', ['style']],
                ['font', ['bold', 'italic', 'underline', 'clear']],
                ['fontname', ['fontname']],
                ['color', ['color']],
                ['para', ['ul', 'ol', 'paragraph']],
                ['height', ['height']],
                ['table', ['table']],
                ['insert', ['link', 'picture', 'hr']],
                // ['view', ['fullscreen', 'codeview']],
                // ['help', ['help']],
            ],
        ]
    ]) ?>
 
    <div class="form-group">
        <?= Html::submitButton('Guardar', ['class' => 'btn btn-success']) ?>
    </div>
 
    <?php ActiveForm::end(); ?>
 
</div>
<script>
$(document).ready(function() {
  $('#summernote').summernote(
      {
        lang: 'es-ES'
      }
  );
});
</script>

Controlador NoticiasController.php acción create.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public function actionCreate()
    {
        $model = new Noticias();
 
        if ($model->load(Yii::$app->request->post())) {
 
            if ( $model->save() ) {
                $this->msgFlashSuccessCreate($model);
            } else {
                $this->msgFlashErrorCreate($model);
            }
            return $this->redirect(['index']);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }

y el modelo Noticias.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
 
namespace app\models;
 
use Yii;
use yii\db\ActiveRecord;
 
/**
 * This is the model class for table "noticias".
 *
 * @property int $id
 * @property string $titulo
 * @property string $noticia
 * @property string $created_at
 * @property string $updated_at
 * @property int $created_by
 * @property int $updated_by
 */
class Noticias extends MyActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'noticias';
    }
 
    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['titulo'], 'required'],
            [['noticia'], 'string'],
            [['created_at', 'updated_at','noticia'], 'safe'],
            [['created_by', 'updated_by'], 'integer'],
            [['titulo'], 'string', 'max' => 50],
        ];
    }
 
    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'titulo' => 'Titulo',
            'noticia' => 'Noticia',
            'created_at' => 'fecha',
            'updated_at' => 'Updated At',
            'created_by' => 'Created By',
            'updated_by' => 'Updated By',
        ];
    }
}

Por favor me pueden ayudar?
Un Cordial saludo desde Valparaíso - Chile
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder