RichTextConfigurationService
Service to resolve RTE configuration for the form editor.
This service prepares CKEditor 5 configuration for use in the TYPO3 Form Editor backend. It loads configuration from global TYPO3 RTE presets, processes external plugins, and transforms the configuration to be compatible with the form editor context.
Similar to RichTextElement, but adapted for the form editor's specific requirements.
Table of Contents
Methods
- __construct() : mixed
- resolveCkEditorConfiguration() : array<string|int, mixed>
- Resolves and prepares CKEditor configuration for the form editor.
- resolveProcessingConfiguration() : array<string|int, mixed>
- Resolves the processing configuration (proc.) for HTML transformations.
- transformTextForPersistence() : string
- Transforms HTML content from RTE format for database persistence.
- transformTextForRichTextEditor() : string
- Transforms HTML content from database format for RTE display.
Methods
__construct()
public
__construct(Richtext $richtext, RteHtmlParser $rteHtmlParser, SystemResourcePublisherInterface $resourcePublisher, SystemResourceFactory $systemResourceFactory, UriBuilder $uriBuilder) : mixed
Parameters
- $richtext : Richtext
- $rteHtmlParser : RteHtmlParser
- $resourcePublisher : SystemResourcePublisherInterface
- $systemResourceFactory : SystemResourceFactory
- $uriBuilder : UriBuilder
resolveCkEditorConfiguration()
Resolves and prepares CKEditor configuration for the form editor.
public
resolveCkEditorConfiguration([string $presetName = 'form-label' ]) : array<string|int, mixed>
This method loads the specified RTE preset from TYPO3's global configuration, processes it, and returns a configuration array ready for use with CKEditor 5.
Parameters
- $presetName : string = 'form-label'
-
Name of the RTE preset (e.g., 'form-label', 'form-content')
Return values
array<string|int, mixed> —The processed CKEditor configuration, or empty array if rte_ckeditor is not loaded
resolveProcessingConfiguration()
Resolves the processing configuration (proc.) for HTML transformations.
public
resolveProcessingConfiguration([string $presetName = 'form-label' ]) : array<string|int, mixed>
This method loads the RTE preset and returns the processing configuration that can be used with RteHtmlParser for HTML transformations.
Note: Unlike resolveCkEditorConfiguration(), this method does NOT check for rte_ckeditor because RteHtmlParser is part of the Core and works independently of the editor.
Parameters
- $presetName : string = 'form-label'
-
Name of the RTE preset (e.g., 'form-label', 'form-content')
Return values
array<string|int, mixed> —The processing configuration array
transformTextForPersistence()
Transforms HTML content from RTE format for database persistence.
public
transformTextForPersistence(string $htmlContent[, string $presetName = 'form-label' ]) : string
Parameters
- $htmlContent : string
-
The HTML content from the RTE editor
- $presetName : string = 'form-label'
-
Name of the RTE preset to use for transformation rules
Return values
string —The transformed HTML ready for database storage
transformTextForRichTextEditor()
Transforms HTML content from database format for RTE display.
public
transformTextForRichTextEditor(string $htmlContent[, string $presetName = 'form-label' ]) : string
Parameters
- $htmlContent : string
-
The HTML content from the database
- $presetName : string = 'form-label'
-
Name of the RTE preset to use for transformation rules
Return values
string —The transformed HTML ready for the RTE editor