Migration from IvoryCKEditorBundle to FOSCKEditorBundle

1.0 version

Migration from IvoryCKEditorBundle to FOSCKEditorBundle

Here we will explain the process of migration.

TL;DR: Check how we migrated SonataFormatterBundle

Update composer.json

1
2
composer remove egeloen/ckeditor-bundle
composer require friendsofsymfony/ckeditor-bundle

Update bundle definition

Replace:

1
2
3
4
5
6
<?php

// config/bundles.php
return [
    Ivory\CKEditorBundle\IvoryCKEditorBundle::class => ['all' => true],
];

With:

1
2
3
4
5
6
<?php

// config/bundles.php
return [
    FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
];

If you are not using Symfony Flex, then replace this in your AppKernel.

Replace:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<?php

// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
            // ...
        ];

        // ...
    }
}

With:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<?php

// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            new FOS\CKEditorBundle\FOSCKEditorBundle(),
            // ...
        ];

        // ...
    }
}

Update configuration root key

Only the root key of the configuration is changed.

Replace:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# config/packages/ivory_ck_editor.yaml

ivory_ck_editor:
    configs:
        my_config:
            toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
            uiColor:                "#000000"
            filebrowserUploadRoute: "my_route"
            extraPlugins:           "wordcount"
            # ...

With:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# config/packages/fos_ck_editor.yaml

fos_ck_editor:
    configs:
        my_config:
            toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
            uiColor:                "#000000"
            filebrowserUploadRoute: "my_route"
            extraPlugins:           "wordcount"
            # ...

If you are not using Symfony Flex, then replace the root key in app/config/config.yml.

Replace:

1
2
3
4
5
6
7
8
9
# app/config/config.yml
ivory_ck_editor:
    configs:
        my_config:
            toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
            uiColor:                "#000000"
            filebrowserUploadRoute: "my_route"
            extraPlugins:           "wordcount"
            # ...

With:

1
2
3
4
5
6
7
8
9
# app/config/config.yml
fos_ck_editor:
    configs:
        my_config:
            toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
            uiColor:                "#000000"
            filebrowserUploadRoute: "my_route"
            extraPlugins:           "wordcount"
            # ...

Update namespace

The main thing that changed is the namespace, so you will have to find all occurrences of Ivory\CKEditorBundle\* in your application and replace them with FOS\CKEditorBundle\*.

Before:

1
2
3
4
5
<?php

use Ivory\CKEditorBundle\Form\Type\CKEditorType;

$form->add('body',  CKEditorType::Class)

After:

1
2
3
4
5
<?php

use FOS\CKEditorBundle\Form\Type\CKEditorType;

$form->add('body',  CKEditorType::Class)

Update service definition

If you are fetching any of the services directly from the container you will have to find all occurrences of ivory_ck_editor.* in your application and replace them with fos_ck_editor.*.

Instead of doing:

$this->get('ivory_ck_editor.form.type');

You would do:

$this-get('fos_ck_editor.form.type');

Regenerate assets

First fetch ckeditor assets:

1
bin/console ckeditor:install

and then regenerate Symfony assets:

1
bin/console assets:install

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.