Skip to content
Permalink
Browse files

EZP-28009: Provided compatibility with external RichText package (#2302)

* [RichText] Moved richtext settings to their own file

The file is only loaded if the RichText bundle class doesn't exist.

Part of EZP-28009.

* [RichText] Disable the config parser if the package is installed

* Added tests for richtext core extension settings loading

* EZP-28009: Don't load richtext services if richtext bundle is loaded
  • Loading branch information...
bdunogier authored and alongosz committed Nov 21, 2018
1 parent 6751ff3 commit d57dd8f1a2e3ca60685d9ca4ec4030cd7add7d53
Showing with 457 additions and 331 deletions.
  1. +35 −0 eZ/Bundle/EzPublishCoreBundle/DependencyInjection/EzPublishCoreExtension.php
  2. +25 −24 eZ/Bundle/EzPublishCoreBundle/EzPublishCoreBundle.php
  3. +0 −55 eZ/Bundle/EzPublishCoreBundle/Resources/config/default_settings.yml
  4. +56 −0 eZ/Bundle/EzPublishCoreBundle/Resources/config/ezrichtext_default_settings.yml
  5. +0 −160 eZ/Bundle/EzPublishCoreBundle/Resources/config/fieldtype_services.yml
  6. +3 −0 eZ/Bundle/EzPublishCoreBundle/Resources/config/richtext.yml
  7. +160 −0 eZ/Bundle/EzPublishCoreBundle/Resources/config/richtext/fieldtype_services.yml
  8. +11 −0 eZ/Bundle/EzPublishCoreBundle/Resources/config/richtext/templating.yml
  9. +0 −10 eZ/Bundle/EzPublishCoreBundle/Resources/config/templating.yml
  10. +62 −3 eZ/Bundle/EzPublishCoreBundle/Tests/DependencyInjection/EzPublishCoreExtensionTest.php
  11. +1 −0 eZ/Publish/Core/settings/containerBuilder.php
  12. +0 −7 eZ/Publish/Core/settings/fieldtype_external_storages.yml
  13. +0 −39 eZ/Publish/Core/settings/fieldtype_services.yml
  14. +0 −14 eZ/Publish/Core/settings/fieldtypes.yml
  15. +0 −6 eZ/Publish/Core/settings/indexable_fieldtypes.yml
  16. +7 −0 eZ/Publish/Core/settings/richtext.yml
  17. +10 −0 eZ/Publish/Core/settings/richtext/fieldtype_external_storages.yml
  18. +42 −0 eZ/Publish/Core/settings/richtext/fieldtype_services.yml
  19. +17 −0 eZ/Publish/Core/settings/richtext/fieldtypes.yml
  20. +9 −0 eZ/Publish/Core/settings/richtext/indexable_fieldtypes.yml
  21. +10 −0 eZ/Publish/Core/settings/richtext/storage_engines/legacy/external_storage_gateways.yml
  22. +9 −0 eZ/Publish/Core/settings/richtext/storage_engines/legacy/field_value_converters.yml
  23. +0 −7 eZ/Publish/Core/settings/storage_engines/legacy/external_storage_gateways.yml
  24. +0 −6 eZ/Publish/Core/settings/storage_engines/legacy/field_value_converters.yml
@@ -182,11 +182,17 @@ private function getMainConfigParser()
*
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
* @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader
*
* @throws \Exception
*/
private function handleDefaultSettingsLoading(ContainerBuilder $container, FileLoader $loader)
{
$loader->load('default_settings.yml');
if (!$this->isRichTextBundleEnabled($container)) {
$loader->load('ezrichtext_default_settings.yml');
}
foreach ($this->defaultSettingsCollection as $fileLocation => $files) {
$externalLoader = new Loader\YamlFileLoader($container, new FileLocator($fileLocation));
foreach ($files as $file) {
@@ -304,6 +310,16 @@ private function registerRichTextConfiguration(array $config, ContainerBuilder $
$config['ezrichtext']['custom_styles']
);
}
// keep BC
if (!empty($config['ezrichtext']) && $this->isRichTextBundleEnabled($container)) {
$container->prependExtensionConfig('ezrichtext', $config['ezrichtext']);
if (!empty($config['ezrichtext']['custom_tags']) || !empty($config['ezrichtext']['custom_styles'])) {
@trigger_error(
'ezpublish.ezrichtext configuration is deprecated since v7.4, move entire configuration node to ezrichtext extension',
E_USER_DEPRECATED
);
}
}
}
/**
@@ -361,6 +377,11 @@ private function handleApiLoading(ContainerBuilder $container, FileLoader $loade
$coreLoader->load('notification.yml');
$coreLoader->load('user_preference.yml');
// Load Core RichText settings
if (!$this->isRichTextBundleEnabled($container)) {
$coreLoader->load('richtext.yml');
}
// Public API services
$loader->load('papi.yml');
@@ -369,6 +390,11 @@ private function handleApiLoading(ContainerBuilder $container, FileLoader $loade
// Storage engine
$loader->load('storage_engines.yml');
// Load CoreBundle RichText settings
if (!$this->isRichTextBundleEnabled($container)) {
$loader->load('richtext.yml');
}
}
/**
@@ -599,4 +625,13 @@ private function registerUrlAliasConfiguration(array $config, ContainerBuilder $
$container->setParameter('ezpublish.url_alias.slug_converter', $config['url_alias']['slug_converter']);
}
private function isRichTextBundleEnabled(ContainerBuilder $container)
{
return $container->hasParameter('kernel.bundles')
&& array_key_exists(
'EzPlatformRichTextBundle',
$container->getParameter('kernel.bundles')
);
}
}
@@ -98,35 +98,36 @@ public function build(ContainerBuilder $container)
$securityExtension->addSecurityListenerFactory(new HttpBasicFactory());
$container->addCompilerPass(new TranslationCollectorPass());
$container->addCompilerPass(new SlugConverterConfigurationPass());
if (!$container->hasExtension('ezrichtext')) {
$this->getContainerExtension()->addConfigParser(new ConfigParser\FieldType\RichText());
}
}
public function getContainerExtension()
{
if (!isset($this->extension)) {
$this->extension = new EzPublishCoreExtension(
array(
// LocationView config parser needs to be specified AFTER ContentView config
// parser since it is used to convert location view override rules to content
// view override rules. If it were specified before, ContentView provider would
// just undo the conversion LocationView did.
new ConfigParser\ContentView(),
new ConfigParser\LocationView(),
new ConfigParser\BlockView(),
new ConfigParser\Common(),
new ConfigParser\Content(),
new ConfigParser\FieldType\RichText(),
new ConfigParser\FieldType\ImageAsset(),
new ConfigParser\FieldTemplates(),
new ConfigParser\FieldEditTemplates(),
new ConfigParser\FieldDefinitionSettingsTemplates(),
new ConfigParser\FieldDefinitionEditTemplates(),
new ConfigParser\Image(),
new ConfigParser\Page(),
new ConfigParser\Languages(),
new ConfigParser\IO(new ComplexSettingParser()),
new ConfigParser\UrlChecker(),
)
);
$this->extension = new EzPublishCoreExtension([
// LocationView config parser needs to be specified AFTER ContentView config
// parser since it is used to convert location view override rules to content
// view override rules. If it were specified before, ContentView provider would
// just undo the conversion LocationView did.
new ConfigParser\ContentView(),
new ConfigParser\LocationView(),
new ConfigParser\BlockView(),
new ConfigParser\Common(),
new ConfigParser\Content(),
new ConfigParser\FieldType\ImageAsset(),
new ConfigParser\FieldTemplates(),
new ConfigParser\FieldEditTemplates(),
new ConfigParser\FieldDefinitionSettingsTemplates(),
new ConfigParser\FieldDefinitionEditTemplates(),
new ConfigParser\Image(),
new ConfigParser\Page(),
new ConfigParser\Languages(),
new ConfigParser\IO(new ComplexSettingParser()),
new ConfigParser\UrlChecker(),
]);
}
return $this->extension;
@@ -21,16 +21,6 @@ parameters:
ezplatform.default_view_templates.content.asset_image: 'EzPublishCoreBundle:default:content/asset_image.html.twig'
ezplatform.default_view_templates.block: 'EzPublishCoreBundle:default:block/block.html.twig'

# Rich Text Custom Tags global configuration
ezplatform.ezrichtext.custom_tags: {}
# Rich Text Custom Tags default scope (for SiteAccess) configuration
ezsettings.default.fieldtypes.ezrichtext.custom_tags: []

# Rich Text Custom Styles global configuration
ezplatform.ezrichtext.custom_styles: {}
# Rich Text Custom Styles default scope (for SiteAccess) configuration
ezsettings.default.fieldtypes.ezrichtext.custom_styles: []

# Image Asset mappings
ezsettings.default.fieldtypes.ezimageasset.mappings:
content_type_identifier: image
@@ -113,51 +103,6 @@ parameters:
ezsettings.default.content.field_groups.default: 'content'

# FieldType settings
# Default XSL stylesheets for RichText rendering to HTML5.
# Built-in stylesheets are treated as custom for the sake of extensibility.
ezsettings.default.fieldtypes.ezrichtext.output_custom_xsl:
-
path: "%kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/RichText/Resources/stylesheets/docbook/xhtml5/output/core.xsl"
priority: 0

ezsettings.default.fieldtypes.ezrichtext.edit_custom_xsl:
-
path: "%kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/RichText/Resources/stylesheets/docbook/xhtml5/edit/core.xsl"
priority: 0

ezsettings.default.fieldtypes.ezrichtext.input_custom_xsl: []

# RichText field type template tag settings
# 'default' and 'default_inline' tag identifiers are reserved for fallback
ezsettings.default.fieldtypes.ezrichtext.tags.default:
template: EzPublishCoreBundle:FieldType/RichText/tag:default.html.twig
ezsettings.default.fieldtypes.ezrichtext.tags.default_inline:
template: EzPublishCoreBundle:FieldType/RichText/tag:default_inline.html.twig

# RichText field type template style settings
# 'default' and 'default_inline' tag identifiers are reserved for fallback
ezsettings.default.fieldtypes.ezrichtext.styles.default:
template: EzPublishCoreBundle:FieldType/RichText/style:default.html.twig
ezsettings.default.fieldtypes.ezrichtext.styles.default_inline:
template: EzPublishCoreBundle:FieldType/RichText/style:default_inline.html.twig

# RichText field type embed settings
ezsettings.default.fieldtypes.ezrichtext.embed.content:
template: EzPublishCoreBundle:FieldType/RichText/embed:content.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.content_denied:
template: EzPublishCoreBundle:FieldType/RichText/embed:content_denied.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.content_inline:
template: EzPublishCoreBundle:FieldType/RichText/embed:content_inline.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.content_inline_denied:
template: EzPublishCoreBundle:FieldType/RichText/embed:content_inline_denied.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.location:
template: EzPublishCoreBundle:FieldType/RichText/embed:location.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.location_denied:
template: EzPublishCoreBundle:FieldType/RichText/embed:location_denied.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.location_inline:
template: EzPublishCoreBundle:FieldType/RichText/embed:location_inline.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.location_inline_denied:
template: EzPublishCoreBundle:FieldType/RichText/embed:location_inline_denied.html.twig

# Cache settings
# Server(s) URL(s) that will be used for purging HTTP cache with BAN requests.
@@ -0,0 +1,56 @@
parameters:
# Rich Text Custom Tags global configuration
ezplatform.ezrichtext.custom_tags: {}
# Rich Text Custom Tags default scope (for SiteAccess) configuration
ezsettings.default.fieldtypes.ezrichtext.custom_tags: []

# Rich Text Custom Styles global configuration
ezplatform.ezrichtext.custom_styles: {}
# Rich Text Custom Styles default scope (for SiteAccess) configuration
ezsettings.default.fieldtypes.ezrichtext.custom_styles: []

# Default XSL stylesheets for RichText rendering to HTML5.
# Built-in stylesheets are treated as custom for the sake of extensibility.
ezsettings.default.fieldtypes.ezrichtext.output_custom_xsl:
-
path: '%kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/RichText/Resources/stylesheets/docbook/xhtml5/output/core.xsl'
priority: 0

ezsettings.default.fieldtypes.ezrichtext.edit_custom_xsl:
-
path: '%kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/RichText/Resources/stylesheets/docbook/xhtml5/edit/core.xsl'
priority: 0

ezsettings.default.fieldtypes.ezrichtext.input_custom_xsl: []

# RichText field type template tag settings
# 'default' and 'default_inline' tag identifiers are reserved for fallback
ezsettings.default.fieldtypes.ezrichtext.tags.default:
template: EzPublishCoreBundle:FieldType/RichText/tag:default.html.twig
ezsettings.default.fieldtypes.ezrichtext.tags.default_inline:
template: EzPublishCoreBundle:FieldType/RichText/tag:default_inline.html.twig

# RichText field type template style settings
# 'default' and 'default_inline' tag identifiers are reserved for fallback
ezsettings.default.fieldtypes.ezrichtext.styles.default:
template: EzPublishCoreBundle:FieldType/RichText/style:default.html.twig
ezsettings.default.fieldtypes.ezrichtext.styles.default_inline:
template: EzPublishCoreBundle:FieldType/RichText/style:default_inline.html.twig

# RichText field type embed settings
ezsettings.default.fieldtypes.ezrichtext.embed.content:
template: EzPublishCoreBundle:FieldType/RichText/embed:content.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.content_denied:
template: EzPublishCoreBundle:FieldType/RichText/embed:content_denied.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.content_inline:
template: EzPublishCoreBundle:FieldType/RichText/embed:content_inline.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.content_inline_denied:
template: EzPublishCoreBundle:FieldType/RichText/embed:content_inline_denied.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.location:
template: EzPublishCoreBundle:FieldType/RichText/embed:location.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.location_denied:
template: EzPublishCoreBundle:FieldType/RichText/embed:location_denied.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.location_inline:
template: EzPublishCoreBundle:FieldType/RichText/embed:location_inline.html.twig
ezsettings.default.fieldtypes.ezrichtext.embed.location_inline_denied:
template: EzPublishCoreBundle:FieldType/RichText/embed:location_inline_denied.html.twig
Oops, something went wrong.

0 comments on commit d57dd8f

Please sign in to comment.
You can’t perform that action at this time.