This bundle implements a flexible configuration system that allows you to define multiple CKEditor configurations in YAML without rebuilding JavaScript assets. The configuration is passed from PHP to JavaScript via Sulu's initializer system.
Add to your config/packages/akawaka_sulu_multi_text_editor.yaml:
akawaka_sulu_multi_text_editor:
configs:
config_name:
editor: ckeditor|tiptap # Editor type (currently only ckeditor supported)
tags: # HTML tags allowed in content
p: true # Paragraph tags
a: true # Links
sulu_link: true # Sulu internal links
ul: true # Unordered lists
ol: true # Ordered lists
h1: false # Heading 1 (usually disabled)
h2: true # Heading 2
h3: true # Heading 3
h4: true # Heading 4
h5: true # Heading 5
h6: true # Heading 6
table: true # Tables
code: true # Code blocks
blockquote: true # Block quotes
strong: true # Bold text
em: true # Italic text
u: false # Underline
s: false # Strikethrough
sub: false # Subscript
sup: false # Superscript
br: true # Line breaks
hr: false # Horizontal rules
toolbar: # CKEditor toolbar configuration
- 'heading'
- '|'
- 'bold'
- 'italic'
- 'link'
# ... more toolbar itemsThe bundle comes with these predefined configs:
- Purpose: Standard editing with common features
- Tags: p, a, sulu_link, ul, ol, h2-h6, table, code, blockquote, strong, em, br
- Toolbar: heading, bold, italic, link, lists, table, blockquote
- Purpose: Simple text editing
- Tags: p, a, strong, em, br
- Toolbar: bold, italic, link
- Purpose: Full-featured editing
- Tags: All tags enabled
- Toolbar: All available tools including formatting, colors, advanced features
<property name="content" type="multi_text_editor">
<meta>
<title lang="en">Content</title>
</meta>
<params>
<param name="config" value="default"/>
</params>
</property><property name="summary" type="multi_text_editor">
<meta>
<title lang="en">Summary</title>
</meta>
<params>
<param name="config" value="minimal"/>
<param name="strip_p_tags" value="true"/>
</params>
</property>- YAML Config → Bundle Extension processes configuration
- Bundle Extension → Stores config in container parameters
- MultiEditorAdmin → Exposes config via
getConfig()method - JavaScript Initializer → Receives config via
addUpdateConfigHook - MultiTextEditor Component → Uses config to configure CKEditor
src/DependencyInjection/Configuration.php- YAML schema definitionsrc/DependencyInjection/MultiEditorExtension.php- Config processingsrc/Admin/MultiEditorAdmin.php- Config exposure to JSsrc/Resources/js/index.js- JavaScript initializersrc/Resources/js/containers/MultiTextEditor/MultiTextEditor.js- Editor component
akawaka_sulu_multi_text_editor:
configs:
my_custom_config:
editor: ckeditor
tags:
p: true
strong: true
em: true
a: true
ul: true
ol: true
toolbar:
- 'bold'
- 'italic'
- '|'
- 'bulletedList'
- 'numberedList'
- '|'
- 'link'<property name="content" type="multi_text_editor">
<params>
<param name="config" value="my_custom_config"/>
</params>
</property>The configuration system is designed to support multiple editors:
akawaka_sulu_multi_text_editor:
configs:
tiptap_config:
editor: tiptap # Future support
tags:
# Same tag structureFuture versions may support custom plugins:
akawaka_sulu_multi_text_editor:
configs:
with_plugins:
editor: ckeditor
plugins:
- 'CustomPlugin'
- 'AnotherPlugin'- No Rebuild Required - Change configurations without recompiling JavaScript
- Multiple Configs - Different editors for different content types
- Tag-Based Control - Fine-grained control over allowed HTML
- Editor Agnostic - Designed to support multiple editor types
- Sulu Integration - Follows Sulu's configuration patterns
- Clear Sulu cache:
bin/console cache:clear - Rebuild admin assets:
bin/console sulu:build dev - Check YAML syntax in configuration file
- Check browser console for errors
- Verify config name matches YAML configuration
- Ensure all required toolbar items are valid for CKEditor
- Check
tagsconfiguration for allowed HTML elements - Verify CKEditor's
allowedContentis properly built - Test with minimal configuration first