migration.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. Migration from IvoryCKEditorBundle to FOSCKEditorBundle
  2. =======================================================
  3. Here we will explain the process of migration.
  4. TL;DR: Check how we migrated `SonataFormatterBundle`_
  5. Update composer.json
  6. --------------------
  7. .. code-block:: bash
  8. composer remove egeloen/ckeditor-bundle
  9. composer require friendsofsymfony/ckeditor-bundle
  10. Update bundle definition
  11. ------------------------
  12. Replace::
  13. <?php
  14. // config/bundles.php
  15. return [
  16. Ivory\CKEditorBundle\IvoryCKEditorBundle::class => ['all' => true],
  17. ];
  18. With::
  19. <?php
  20. // config/bundles.php
  21. return [
  22. FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
  23. ];
  24. If you are not using Symfony Flex, then replace this in your AppKernel.
  25. Replace::
  26. <?php
  27. // app/AppKernel.php
  28. class AppKernel extends Kernel
  29. {
  30. public function registerBundles()
  31. {
  32. $bundles = [
  33. new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
  34. // ...
  35. ];
  36. // ...
  37. }
  38. }
  39. With::
  40. <?php
  41. // app/AppKernel.php
  42. class AppKernel extends Kernel
  43. {
  44. public function registerBundles()
  45. {
  46. $bundles = [
  47. new FOS\CKEditorBundle\FOSCKEditorBundle(),
  48. // ...
  49. ];
  50. // ...
  51. }
  52. }
  53. Update configuration root key
  54. ------------------------------
  55. Only the root key of the configuration is changed.
  56. Replace:
  57. .. code-block:: yaml
  58. # config/packages/ivory_ck_editor.yaml
  59. ivory_ck_editor:
  60. configs:
  61. my_config:
  62. toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
  63. uiColor: "#000000"
  64. filebrowserUploadRoute: "my_route"
  65. extraPlugins: "wordcount"
  66. # ...
  67. With:
  68. .. code-block:: yaml
  69. # config/packages/fos_ck_editor.yaml
  70. fos_ck_editor:
  71. configs:
  72. my_config:
  73. toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
  74. uiColor: "#000000"
  75. filebrowserUploadRoute: "my_route"
  76. extraPlugins: "wordcount"
  77. # ...
  78. If you are not using Symfony Flex, then replace the root key in ``app/config/config.yml``.
  79. Replace:
  80. .. code-block:: yaml
  81. # app/config/config.yml
  82. ivory_ck_editor:
  83. configs:
  84. my_config:
  85. toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
  86. uiColor: "#000000"
  87. filebrowserUploadRoute: "my_route"
  88. extraPlugins: "wordcount"
  89. # ...
  90. With:
  91. .. code-block:: yaml
  92. # app/config/config.yml
  93. fos_ck_editor:
  94. configs:
  95. my_config:
  96. toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
  97. uiColor: "#000000"
  98. filebrowserUploadRoute: "my_route"
  99. extraPlugins: "wordcount"
  100. # ...
  101. Update namespace
  102. ----------------
  103. The main thing that changed is the namespace, so you will have to find
  104. all occurrences of ``Ivory\CKEditorBundle\*`` in your application and
  105. replace them with ``FOS\CKEditorBundle\*``.
  106. Before::
  107. <?php
  108. use Ivory\CKEditorBundle\Form\Type\CKEditorType;
  109. $form->add('body', CKEditorType::Class)
  110. After::
  111. <?php
  112. use FOS\CKEditorBundle\Form\Type\CKEditorType;
  113. $form->add('body', CKEditorType::Class)
  114. Update service definition
  115. -------------------------
  116. If you are fetching any of the services directly from the container you
  117. will have to find all occurrences of ``ivory_ck_editor.*`` in your application
  118. and replace them with ``fos_ck_editor.*``.
  119. Instead of doing::
  120. $this->get('ivory_ck_editor.form.type');
  121. You would do::
  122. $this-get('fos_ck_editor.form.type');
  123. Regenerate assets
  124. -----------------
  125. First fetch ckeditor assets:
  126. .. code-block:: bash
  127. bin/console ckeditor:install
  128. and then regenerate Symfony assets:
  129. .. code-block:: bash
  130. bin/console assets:install
  131. .. _`SonataFormatterBundle`: https://github.com/sonata-project/SonataFormatterBundle/pull/331