I'd like to add ckeditor to content field in block admin. Here's what i did till now:
modified buildEditForm in TextBlockService to this:
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']
)),
)
));
}
It works just fine, allowing me to choose 'richhtml' from editors list but when i try to save the block it throws an error:
Expected argument of type "string or Symfony\Component\PropertyAccess\PropertyPathInterface", "NULL" given
How can i fix that?
here's how it should be to work:
$formMapper->add('settings', 'ckeditor', array());