diff --git a/src/bundle/DependencyInjection/Compiler/KernelRichTextPass.php b/src/bundle/DependencyInjection/Compiler/KernelRichTextPass.php new file mode 100644 index 00000000..51880c7c --- /dev/null +++ b/src/bundle/DependencyInjection/Compiler/KernelRichTextPass.php @@ -0,0 +1,60 @@ +hasDefinition($service)) { + $container->log($this, "Removed ezpublish-kernel richtext service: $service"); + $container->removeDefinition($service); + } + }, + $this->servicesToRemove + ); + + $def = $container->getDefinition('ezpublish.persistence.legacy.field_value_converter.registry'); + $methodCalls = []; + foreach ($def->getMethodCalls() as $methodCall) { + if ($methodCall[0] != 'register') { + $methodCalls[] = $methodCall; + continue; + } + + if ($methodCall[1][0] != 'ezrichtext') { + $methodCalls[] = $methodCall; + continue; + } + + if (!$methodCall[1][1] instanceof Reference || (string)$methodCall[1][1] !== 'ezpublish.fieldType.ezrichtext.converter') { + $methodCalls[] = $methodCall; + continue; + } + } + $def->setMethodCalls($methodCalls); + } +} diff --git a/src/bundle/EzPlatformRichTextFieldTypeBundle.php b/src/bundle/EzPlatformRichTextFieldTypeBundle.php index 12549fb7..fefc69a8 100644 --- a/src/bundle/EzPlatformRichTextFieldTypeBundle.php +++ b/src/bundle/EzPlatformRichTextFieldTypeBundle.php @@ -25,6 +25,7 @@ public function build(ContainerBuilder $container) { parent::build($container); $container->addCompilerPass(new RichTextHtml5ConverterPass()); + $container->addCompilerPass(new KernelRichTextPass()); $this->registerConfigParser($container); } diff --git a/tests/integration/eZ/API/LegacySetupFactory.php b/tests/integration/eZ/API/LegacySetupFactory.php index 192e9d7f..8d45a19c 100644 --- a/tests/integration/eZ/API/LegacySetupFactory.php +++ b/tests/integration/eZ/API/LegacySetupFactory.php @@ -32,6 +32,7 @@ protected function externalBuildContainer(ContainerBuilder $containerBuilder) $loader->load('storage_engines/legacy/external_storage_gateways.yml'); $loader->load('storage_engines/legacy/field_value_converters.yml'); + $containerBuilder->addCompilerPass(new Compiler\KernelRichTextPass()); $containerBuilder->addCompilerPass(new Compiler\RichTextHtml5ConverterPass()); } }