I'm trying to figure out the correct way to implement CKEditor with Symfony CMF. I have a working implementation but I'm not sure it's the correct way to do it.
What I have done is override the sonata_admin
edit template with:
config.yml
sonata_admin:
...
templates:
edit: MyBundle:CRUD:edit.html.twig
edit.html.twig
{% extends 'SonataAdminBundle:CRUD:base_edit.html.twig' %}
{% block javascripts %}
{{ parent() }}
<script src="//cdn.ckeditor.com/4.5.0/standard/ckeditor.js"></script>
<script type="text/javascript">
$(function() {
$('textarea.ckeditor').ckeditor();
});
</script>
{% endblock %}
Then I've added the ckeditor
class to my textarea fields in the admin panels.
Whilst this works I am aware that CMF has a CreateBundle
which contains CKEditor, but I haven't found any documentation on how this can be linked to the admin pages. I'm wondering whether that has any benefits over my current solution.