Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 91dc9a3

Browse files
committed
introduce fos_ckeditor
1 parent 5fa9d85 commit 91dc9a3

File tree

8 files changed

+35
-30
lines changed

8 files changed

+35
-30
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4-
1.0.0 (unreleased)
4+
2.0.0 (unreleased)
55
------------------
66

7+
* **2019-01-29**: [BC-BREAK] Replace IvoryCkEditor by FOSCkEditor.
8+
Follow the migration Guide at: https://symfony.com/doc/master/bundles/FOSCKEditorBundle/migration.html
9+
10+
1.0.0
11+
-----

composer.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
"matthiasnoback/symfony-dependency-injection-test": "^1.1",
3838
"matthiasnoback/symfony-config-test": "^2.1",
3939
"burgov/key-value-form-bundle": "^1.0",
40-
"egeloen/ckeditor-bundle": "^4.0",
40+
"friendsofsymfony/ckeditor-bundle": "^1.0",
41+
"sebastian/environment": "^1.3.4",
42+
"sebastian/exporter": "^2.0.0",
4143
"symfony/asset": "^2.8 || ^3.3 || ^4.0",
4244
"symfony/browser-kit": "^2.8 || ^3.3 || ^4.0",
4345
"symfony/css-selector": "^2.8 || ^3.3 || ^4.0"
@@ -47,7 +49,7 @@
4749
"doctrine/phpcr-bundle": "To persist the metadata in PHPCR ODM documents",
4850
"doctrine/doctrine-bundle": "To persist the metadata in ORM entities",
4951
"doctrine/orm": "To persist the metadata in ORM entities, ~2.4",
50-
"egeloen/ckeditor-bundle": "To have CkEditor support on textareas."
52+
"friendsofsymfony/ckeditor-bundl": "To have CkEditor support on textareas."
5153
},
5254
"autoload": {
5355
"psr-4": {
@@ -61,13 +63,9 @@
6163
},
6264
"extra": {
6365
"branch-alias": {
64-
"dev-master": "1.1-dev"
66+
"dev-master": "2.0-dev"
6567
}
6668
},
67-
"conflict": {
68-
"sebastian/environment": "<1.3.4",
69-
"sebastian/exporter": "<2.0.0"
70-
},
7169
"minimum-stability": "dev",
7270
"prefer-stable": true
7371
}

src/Admin/Content/StaticContentAdmin.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Admin\Content;
1313

14-
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
14+
use FOS\CKEditorBundle\Form\Type\CKEditorType;
1515
use Sonata\AdminBundle\Datagrid\DatagridMapper;
1616
use Sonata\AdminBundle\Datagrid\ListMapper;
1717
use Sonata\AdminBundle\Form\FormMapper;
@@ -40,7 +40,7 @@ public function getExportFormats()
4040
/**
4141
* Set configuration for CKEditorType.
4242
*
43-
* Documentation: http://symfony.com/doc/master/bundles/IvoryCKEditorBundle/usage/config.html
43+
* Documentation: https://symfony.com/doc/master/bundles/FOSCKEditorBundle/usage/config.html
4444
*
4545
* @param array $config configuration for CKEditorType
4646
*/

src/DependencyInjection/Factory/ContentAdminFactory.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\DependencyInjection\Factory;
1313

14-
use Ivory\CKEditorBundle\IvoryCKEditorBundle;
14+
use FOS\CKEditorBundle\FOSCKEditorBundle;
1515
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
1616
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1717
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -38,7 +38,7 @@ public function getKey()
3838
public function addConfiguration(NodeBuilder $builder)
3939
{
4040
$builder
41-
->arrayNode('ivory_ckeditor')
41+
->arrayNode('fos_ckeditor')
4242
->treatFalseLike(['enabled' => false])
4343
->treatTrueLike(['enabled' => true])
4444
->treatNullLike(['enabled' => 'auto'])
@@ -62,22 +62,22 @@ public function create(array $config, ContainerBuilder $container, XmlFileLoader
6262
{
6363
$loader->load('content.xml');
6464

65-
$message = 'IvoryCKEditorBundle integration was explicitely enabled, but the bundle is not available.';
66-
if (class_exists(IvoryCKEditorBundle::class)) {
65+
$message = 'FOSCKEditorBundle integration was explicitely enabled, but the bundle is not available.';
66+
if (class_exists(FOSCKEditorBundle::class)) {
6767
$message .= ' (did you forget to register the bundle in the AppKernel?)';
6868
}
6969

7070
$ckeditorConfig = [];
71-
if ($this->isConfigEnabledAuto($container, $config['ivory_ckeditor']['enabled'], 'IvoryCKEditorBundle', $message)) {
72-
if (!isset($config['ivory_ckeditor']['config_name'])) {
73-
throw new InvalidConfigurationException('The cmf_sonata_phpcr_admin_integration.bundles.content.ivory_ckeditor.config_name setting has to be defined when IvoryCKEditorBundle integration is enabled.');
71+
if ($this->isConfigEnabledAuto($container, $config['fos_ckeditor']['enabled'], 'FOSCKEditorBundle', $message)) {
72+
if (!isset($config['fos_ckeditor']['config_name'])) {
73+
throw new InvalidConfigurationException('The cmf_sonata_phpcr_admin_integration.bundles.content.fos_ckeditor.config_name setting has to be defined when FOSCKEditorBundle integration is enabled.');
7474
}
7575

76-
unset($config['ivory_ckeditor']['enabled']);
76+
unset($config['fos_ckeditor']['enabled']);
7777

78-
$ckeditorConfig = $config['ivory_ckeditor'];
78+
$ckeditorConfig = $config['fos_ckeditor'];
7979
}
8080

81-
$container->setParameter('cmf_sonata_phpcr_admin_integration.content.ivory_ckeditor', $ckeditorConfig);
81+
$container->setParameter('cmf_sonata_phpcr_admin_integration.content.fos_ckeditor', $ckeditorConfig);
8282
}
8383
}

src/Resources/config/content.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</call>
3030

3131
<call method="setCkEditorConfig">
32-
<argument>%cmf_sonata_phpcr_admin_integration.content.ivory_ckeditor%</argument>
32+
<argument>%cmf_sonata_phpcr_admin_integration.content.fos_ckeditor%</argument>
3333
</call>
3434
</service>
3535
</services>

tests/Fixtures/App/config/bundles.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle::class => ['all' => true],
2828
Symfony\Cmf\Bundle\ContentBundle\CmfContentBundle::class => ['all' => true],
2929
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
30-
Ivory\CKEditorBundle\IvoryCKEditorBundle::class => ['all' => true],
30+
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
3131
SonataBlockBundle::class => ['all' => true],
3232
SonataCoreBundle::class => ['all' => true],
3333
SonataAdminBundle::class => ['all' => true],

tests/Fixtures/App/config/cmf_sonata_admin_integration.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cmf_sonata_phpcr_admin_integration:
44
core: ~
55
menu: ~
66
content:
7-
ivory_ckeditor: { config_name: cmf_sonata_admin_integration }
7+
fos_ckeditor: { config_name: cmf_sonata_admin_integration }
88

99
routing:
1010
basepath: /test/routing
@@ -36,6 +36,8 @@ cmf_routing:
3636

3737
twig:
3838
exception_controller: cmf_seo.error.suggestion_provider.controller:listAction
39+
form_themes:
40+
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
3941

4042
cmf_core:
4143
persistence:
@@ -44,7 +46,7 @@ cmf_core:
4446
multilang:
4547
locales: [en, de]
4648

47-
ivory_ck_editor:
49+
fos_ck_editor:
4850
configs:
4951
cmf_sonata_admin_integration: { toolbar: standard }
5052

tests/Unit/DependencyInjection/Factory/ContentAdminFactoryTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ protected function setUp()
3333
{
3434
$this->factory = new ContentAdminFactory();
3535
$this->container = new ContainerBuilder();
36-
$this->container->setParameter('kernel.bundles', ['IvoryCKEditorBundle' => true]);
36+
$this->container->setParameter('kernel.bundles', ['FOSCKEditorBundle' => true]);
3737
$this->fileLoader = $this->createMock(XmlFileLoader::class);
3838
}
3939

4040
/**
4141
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
42-
* @expectedExceptionMessage config_name setting has to be defined when IvoryCKEditorBundle integration is enabled
42+
* @expectedExceptionMessage config_name setting has to be defined when FOSCKEditorBundle integration is enabled
4343
*/
4444
public function testInvalidCKEditorEnabledWithoutConfigName()
4545
{
@@ -56,26 +56,26 @@ public function testCKEditorDisabledWithoutConfigName()
5656
{
5757
$config = $this->process($this->buildConfig(), [[
5858
'bundles' => [
59-
'content' => ['ivory_ckeditor' => false],
59+
'content' => ['fos_ckeditor' => false],
6060
],
6161
]]);
6262

6363
$this->create($config);
6464

65-
$this->assertEquals([], $this->container->getParameter('cmf_sonata_phpcr_admin_integration.content.ivory_ckeditor'));
65+
$this->assertEquals([], $this->container->getParameter('cmf_sonata_phpcr_admin_integration.content.fos_ckeditor'));
6666
}
6767

6868
public function testCKEditorEnabledWithConfigName()
6969
{
7070
$config = $this->process($this->buildConfig(), [[
7171
'bundles' => [
72-
'content' => ['ivory_ckeditor' => ['config_name' => 'default']],
72+
'content' => ['fos_ckeditor' => ['config_name' => 'default']],
7373
],
7474
]]);
7575

7676
$this->create($config);
7777

78-
$this->assertEquals(['config_name' => 'default'], $this->container->getParameter('cmf_sonata_phpcr_admin_integration.content.ivory_ckeditor'));
78+
$this->assertEquals(['config_name' => 'default'], $this->container->getParameter('cmf_sonata_phpcr_admin_integration.content.fos_ckeditor'));
7979
}
8080

8181
protected function buildConfig()

0 commit comments

Comments
 (0)