dongyo1959 2019-04-29 10:48
浏览 82

Symfony 3 - CKEditor不再起作用了

I just noticed that my CKEditor does not work anymore. It had been a few days since I had not been to the page that uses CKEditor on my site. But the facts are there. I only have a simple Textaera instead of the CKEditor tool.

Is there a way to see where the problem comes from?

My AppKernel.php:

$bundles = [
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new AppBundle\AppBundle(),
            new Site\PagesBundle\PagesBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            new Vich\UploaderBundle\VichUploaderBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new FOS\CKEditorBundle\FOSCKEditorBundle(),
            new Besancon\AuthBundle\BesanconAuthBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),
        ];

A part of my config.yml:

fos_ck_editor:
    configs:
        my_config:
            toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
            uiColor:                "#000000"

The formType :

<?php

namespace Site\PagesBundle\Form;

use Symfony\Component\Form\AbstractType;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\RangeType;

class InformationType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
        ->add('titre',TextType::class,array(
            'attr' => array(
                'placeholder'=> 'Titre de l\'information',
                'class'=>'form-control'
            )
        ))
        ->add('contenu', CKEditorType::class, array(
            'config' => array(
                'uiColor' => '#ffffff',
                'toolbar'=>'full'
            ),))
        ->add('zone',ChoiceType::class, array(
            'choices'=> array(
                'Zone 1'=>'Zone 1',
                'Zone 2'=>'Zone 2',
                'Zone 3'=>'Zone 3',

            ),
        ))
        ->add('criticite', RangeType::class, array(
            'label'=> 'Taux de criticité',
            'attr'=>array(
                'list'=> 'tauxCriticite'
            )
        ))
        ;
    }

And the twig file :

{% extends 'base.html.twig' %}


{% block body %}
    <h1>Information creation</h1>

    {{ form_start(form) }}

        {{form_row (form.titre)}}

        {{form_row (form.zone)}}

        {{form_row (form.contenu)}}

        {{form_row (form.criticite)}}
        <datalist id="tauxCriticite">
            <option value="0" label="0%">
            <option value="10">
            <option value="20">
            <option value="30">
            <option value="40">
            <option label="50" value="50">
            <option value="60">
            <option value="70">
            <option value="80">
            <option value="90">
            <option value="100" label="100%">
          </datalist>

          <input class="btn btn-primary" type="submit" value="Ajouter"/>
          <a href="{{path('informations_index')}}" class="btn btn-primary">Retour</a>
    {{ form_end(form) }}

{% endblock %}

So, we agree that it's not a configuration problem ?

EDIT : I also add the fact that I have the ckeditor bundle in my bundle, and that I also have the ckeditor folder in the "web" folder

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog