Symfony2 IvoryCKEditorBundle - CK编辑器没有显示

时间:2016-06-08 11:21:27

标签: javascript php forms symfony ckeditor

我试图在我的textarea表单中显示CK编辑器但没有成功:(。我已经在github,symfony doc,IvoryCKEditorBundle等中搜索过,但仍然无法弄清楚它为什么不显示给我。

我安装了:

  • 象牙\ CKEditorBundle \ IvoryCKEditorBundle(),

  • 象牙\ FormExtraBundle \ IvoryFormExtraBundle()

  • 资产

这是我的配置:

class MatchScheduleType extends AbstractType
{
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
    $builder->add('content', CKEditorType::class,
                    array('label' => 'content',
                          'required' => false,
                          'config_name' => 'my_config',
                          'trim' => true
                    )
            )
            ->add('save', SubmitType::class, array('label' => 'saveButtonValue'));
  }

  public function configureOptions(OptionsResolver $resolver)
  {
    $resolver->setDefaults(array(
      'data_class' => 'fcHlinskoBundle\Entity\MatchSchedule',

这是一个具有以下形式的类:

class DefaultController extends Controller
{
  public function indexAction()
  {
    $post = new MatchSchedule();
    $form = $this->createForm(MatchScheduleType::class, $post, array(
        'action' => $this->generateUrl('homepage'),
        'method' => 'POST',
      ));

    return $this->render('fcHlinskoBundle:Default:index.html.twig', array(
            'form' => $form->createView(),
        ));
  }
// ...

我有一个简单的实体MatchSchedule .. 然后我尝试从控制器传递表单:

{{ form_start(form) }}
  {{ form_javascript(form) }}
{{ form_end(form) }}

并将其显示在树枝内:

<form name="match_schedule" method="post" action="/app_dev.php/">

<script type="text/javascript">        

    if (CKEDITOR.instances["match_schedule_content"]) { delete CKEDITOR.instances["match_schedule_content"]; }

    CKEDITOR.plugins.addExternal("name", "/", "");

    if (CKEDITOR.stylesSet.get("name") === null) { CKEDITOR.stylesSet.add("name", []); }

    CKEDITOR.replace("match_schedule_content", {"toolbar":[["Source","-","NewPage","Preview","Print","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Undo","Redo"],["Find","Replace","-","SelectAll","-","Scayt"],...... etc.

    </script>


    <div><label for="match_schedule_content">obsah</label>    <textarea id="match_schedule_content" name="match_schedule[content]"></textarea>

    </div><div><button type="submit" id="match_schedule_save" name="match_schedule[save]">odeslat</button></div><input type="hidden" id="match_schedule__token" name="match_schedule[_token]" value="E-zJ2sUyfDIxGP3gljVQGpj8FWId3a8_FIJw3rLkOYU" /></form>

我在html代码中得到了这个结果:

val query = TableQuery[FooTable]
val givenLongValue = 10L
val action = query.map(_.amount).sum.result.flatMap {
  case Some(sum) if sum <= givenLongValue => DBIO.seq(...)
  case _ => DBIO.successful(...) // You should decide here what you want to return in case of `None` or `sum > 10L`
}.transactionally

所有这些只会产生简单的默认textarea,标签为提交按钮。 没有CK编辑。谁能告诉我我做错了什么?我真的没有想法,对于每一条建议都是如此:)

0 个答案:

没有答案