Skip to content

Commit

Permalink
AlloyEditor Configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
SerheyDolgushev committed Mar 27, 2019
1 parent 73b5dc2 commit 7071007
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public function getConfigTreeBuilder()
$this
->addCustomTagsSection($sections);
$this
->addCustomStylesSection($sections)
->addCustomStylesSection($sections);
$this
->addAlloyEditorSection($sections)
->end();

return $treeBuilder;
Expand Down Expand Up @@ -157,4 +159,32 @@ private function addCustomStylesSection(NodeBuilder $ezRichTextNode)
->end()
;
}

/**
* Define RichText AlloyEditor Semantic Configuration.
*
* The configuration is available at:
* <code>
* ezpublish:
* ezrichtext:
* alloy_editor:
* </code>
*
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $ezRichTextNode
*
* @return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition
*/
private function addAlloyEditorSection(NodeBuilder $ezRichTextNode)
{
return $ezRichTextNode
->arrayNode('alloy_editor')
->children()
->arrayNode('extra_plugins')
->example(['plugin1', 'plugin2'])
->prototype('scalar')->end()
->end()
->end()
->end()
;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class EzPlatformRichTextExtension extends Extension implements PrependExtensionI
{
const RICHTEXT_CUSTOM_STYLES_PARAMETER = 'ezplatform.ezrichtext.custom_styles';
const RICHTEXT_CUSTOM_TAGS_PARAMETER = 'ezplatform.ezrichtext.custom_tags';
const RICHTEXT_ALLOY_EDITOR_PARAMETER = 'ezplatform.ezrichtext.alloy_editor';

/**
* @deprecated aliasing Kernel RichText classes with the ones from this bundle will be dropped
Expand Down Expand Up @@ -89,6 +90,7 @@ private function registerRichTextConfiguration(array $config, ContainerBuilder $
{
$customTagsConfig = $config['custom_tags'] ?? [];
$customStylesConfig = $config['custom_styles'] ?? [];
$alloyEditorConfig = $config['alloy_editor'] ?? [];

$availableSiteAccesses = $container->hasParameter('ezpublish.siteaccess.list')
? $container->getParameter('ezpublish.siteaccess.list')
Expand All @@ -111,6 +113,7 @@ private function registerRichTextConfiguration(array $config, ContainerBuilder $

$container->setParameter(static::RICHTEXT_CUSTOM_TAGS_PARAMETER, $customTagsConfig);
$container->setParameter(static::RICHTEXT_CUSTOM_STYLES_PARAMETER, $customStylesConfig);
$container->setParameter(static::RICHTEXT_ALLOY_EDITOR_PARAMETER, $alloyEditorConfig);
}

/**
Expand Down

0 comments on commit 7071007

Please sign in to comment.