我想将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
我该如何解决?
答案 0 :(得分:3)
这是应该如何工作:
$formMapper->add('settings', 'ckeditor', array());