我想将ckeditor添加到块管理的内容字段中。这是我到目前为止所做的:
在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] 删除。
我来说两句