奏鸣曲管理员添加richhtml编辑器以阻止内容

诺那

我想将ckeditor添加到块管理的内容字段中。这是我到目前为止所做的:

  1. 在我的块中添加了raw_content和content_formatter属性
  2. 在TextBlockService中将buildEditForm修改为:

    public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
    {
    $formMapper->add('settings', 'sonata_type_immutable_array', array(
        'keys' => array(
            array('content', 'sonata_formatter_type', array(
                'event_dispatcher' => $formMapper->getformBuilder()->getEventDispatcher(),
                'format_field'   => ['content_formatter'],
                'source_field'   => ['raw_content'],
                'source_field_options'      => array(
                    'attr' => array('class' => 'span10', 'rows' => 10)
                ),
                'listener'       => true,
                'target_field'   => ['content']
            )),
        )
    ));
    }
    

它工作得很好,允许我从编辑器列表中选择“ richhtml”,但是当我尝试保存块时会抛出错误:

Expected argument of type "string or Symfony\Component\PropertyAccess\PropertyPathInterface", "NULL" given 

我该如何解决?

诺那

这是应该如何工作的:

$formMapper->add('settings', 'ckeditor', array());

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章