How to use CK editor html in sonata admin

SOLUTION

1- Install ckeditor-bundle
dehu-composer require friendsofsymfony/ckeditor-bundle

2- Install the assets

  • docker-compose exec -u www-data dehu-php bin/console ckeditor:install(already installed)

  • docker-compose exec -u www-data dehu-php bin/console assets:install

3- Create a config file called fos_ckeditor.yaml:

fos_ckeditor.yaml

twig:
form_themes:

'@FOSCKEditor/Form/ckeditor_widget.html.twig'
fos_ck_editor:
default_config: default
configs:
default:

default toolbar plus Format button
toolbar:
[Bold, Italic, Underline, -, Cut, Copy, Paste,
PasteText, PasteFromWord, -, Undo, Redo, -,
NumberedList, BulletedList, -, Outdent, Indent, -,
Blockquote, -, Image, Link, Unlink, Table]
[Format, Maximize, Source]

4-For using this asign CKEditorType::class in the type, example:

->add('message', CKEditorType::class, ['label' => 'Message'])

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *