Ivory Becomes FOS Now – CKEditor Bundle for Symfony

Avatar von Maximilian Berghoff

Maybe you heard about it: The Symfony Bundle „egeloen/ckeditor-bundle“ was looking for a new maintainer. And the Symfony 4 compatibility was missing. Having the downloads in mind I did not expect it to be that difficult to find new maintainers. At the end Marko Kunic and I took that place. But let us take a look back into the history.

History

Back in Oktober 2017, we started porting all of our packages into a state were we were able to use Symfony 4. Doing so a list (persisted in a simple shared excel sheet) began to live. There we tried to visualize symfony bundles and their state. Personaly I worked to get the bundles in symfony-cmf namespace running on SF4. To achieve this, there were not only deprecations to fix in the CMF-bundles, but also in their dependencies. So I made a lot of Pull Requests on other bundles and components to at least allow Symfony 4.

During the refactoring I came across the IvoryCKEditorBundle which was maintained by Eric Geldon. Because he had no spare time, he was not able to continue maintaining his repositories any longer. His announcements on Twitter to find a new maintainer had no success and I simply made a PR on two of his repositories, to get them ready for Symfony 4 and avoid deprecation warnings in CMF. I had the hope, that at least a merge and release would be possible.

In discussions in that PR I got to know other developers interested in getting this bundle into a Symfony 4 compatible state: Marko Kunic, who normally maintains Sonata and Fabien Bourigault. Together we came to a point which was absolutely usable for the bundle; but no maintainer means no merge, means no release.

At the Symfony Usergroup in Berlin I talked with Christian Flothmann about that topic in february. Together we came to the point that the bundle could be moved in the „Friends of Symfony“ namespace. Together with Marko and Fabien I wanted to go that way and we decided to take over the bundle. But „taking over“ sounds very harsh – so what to do? I know Lukas as the man for diversity in the symfony community and he should have a good feeling for the community. So I took him and Christian into the discussion. He also has admin rights in the FOS organisation  and so I pursued the topic with Christian and him.

Birth

But it took almost two months until we got our repository into the FOS namespace. We tried to reach Eric several times, to get him to simply move his repos. But no success. At the end wie copied the repostory, I switched my target of my PR and the a new package was born: FOSCKEditorBundle

On its first version we simply concentrated on getting the Symfony 4 support out there. We (Marko on Sonata and I on CMF) were waiting months to get our own stuff stable and I think others did same. But there had been some changes we had to do:

  • Namespaces: Moving from „Ivory“ to „FOS“
  • Service and parameter prefixes: Moving from „ivory_“ to „fos_“

So we also created a guide how to migrate the bundle, because all its usages have to be changed or modified now. Lets have a look into some examples.

Examples

It starts with the composer dependency. You should do composer require friendsofsymfony/ckeditor-bundle. Instead of registering Ivory\CKEditorBundle\IvoryCKEditorBundle::class you have to use FOS\CKEditorBundle\FOSCKEditorBundle::class. (Hint: if you install via Flex, you won’t do that at all). The most used part of the bundle should be the form type, so how to get that one?

# the old way
use Ivory\CKEditorBundle\Form\Type\CKEditorType; $form->add('body', CKEditorType::Class)
 
 
# the new way
use FOS\CKEditorBundle\Form\Type\CKEditorType; $form->add('body', CKEditorType::Class)

Here you can see the change in the namespace. If you use more classes of the bundle, you should change their usages accordingly.

Having the type is not enough? Knowing pure CKEditor, you should know that it lives from a wide configuration. So if you use Symfony configuration to configure the CKEdior of your form type, you should switch the configuration key:

# config/packages/ivory_ck_editor.yaml -> the old way
ivory_ck_editor:
    configs:
        my_config:
            toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
            uiColor: "#000000"
            filebrowserUploadRoute: "my_route"
            extraPlugins: "wordcount"
 
 
# config/packages/fos_ck_editor.yaml -> the new way
fos_ck_editor:
    configs:
        my_config:
            toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
            uiColor: "#000000"
            filebrowserUploadRoute: "my_route"
            extraPlugins: "wordcount"

So the migration should be as easy as possible – all the usages around the world should migrate now. And when I talk about usages, I mean each of the 2.1 Mio downloads on packagist. If you still got questions you can find us in #ckeditor channel of Symfony Slack. You can also open an issue on GitHub or grab us when meeting us on conferences.

Roadmap

We do not want to stop now that we have achieved SF4 compatibility, We want to continue working on the package. So there are lots of refactoring issues in our backlog and with CKEditor5 lots of new stuff will be available. All that stuff will go into a version 2.0 with possible BC breaks.

Avatar von Maximilian Berghoff

Kommentare

6 Antworten zu „Ivory Becomes FOS Now – CKEditor Bundle for Symfony“

  1. Lesetipp: Ivory Becomes FOS Now – CKEditor Bundle for Symfony https://t.co/iwzCX3my0r https://t.co/ZIqQZfEIzQ

  2. Who did not get it today? Ivory becomes FOS! read https://t.co/Yxi76EnJbq or announced in #symfony blog: https://t.co/tNHbJnEOIA

  3. Ivory becomes FOS – a short story about the #CKEditor Bundle for Symfony: https://t.co/dCvWyg2RCp

  4. Unser @ElectricMaxxx über die Geschichte des #CKEditor Bundle für Symfony: https://t.co/dCvWyg2RCp

  5. Wie aus Ivory FOS wurde … oder: Die Geschichte des #CKEditor-Bundles für Symfony – https://t.co/dCvWyg2RCp

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert


Für das Handling unseres Newsletters nutzen wir den Dienst HubSpot. Mehr Informationen, insbesondere auch zu Deinem Widerrufsrecht, kannst Du jederzeit unserer Datenschutzerklärung entnehmen.