FormEditorEnrichmentService implements SingletonInterface
Service to enrich form editor definitions with additional runtime data.
This service processes form editor definitions and enriches them with additional configuration data that is needed for the form editor UI. Currently, it handles the enrichment of textarea editors with RTE options.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Methods
- __construct() : mixed
- enrichFormEditorDefinitions() : array<string|int, mixed>
- Enrich form editor definitions with RTE options and other runtime data.
- enrichDefinitionWithRichTextOptions() : void
- Enrich a single definition with RTE options for its editors and property collections.
- enrichEditorsWithRichTextOptions() : void
- Enrich editors array with RTE options if enableRichtext is set.
- enrichPropertyCollectionsWithRichTextOptions() : void
- Enrich property collections (e.g., finishers, validators) with RTE options.
- resolveRichTextOptions() : array<string|int, mixed>
- Resolve CKEditor configuration options for the given editor.
- shouldEnrichEditorWithRichText() : bool
- Check if an editor should be enriched with RTE options.
Methods
__construct()
public
__construct(RichTextConfigurationService $richTextConfigurationService) : mixed
Parameters
- $richTextConfigurationService : RichTextConfigurationService
enrichFormEditorDefinitions()
Enrich form editor definitions with RTE options and other runtime data.
public
enrichFormEditorDefinitions(array<string|int, mixed> $formEditorDefinitions) : array<string|int, mixed>
Processes all form editor definitions and adds CKEditor configuration to textarea editors that have enableRichtext enabled.
Parameters
- $formEditorDefinitions : array<string|int, mixed>
-
The form editor definitions to enrich
Return values
array<string|int, mixed> —The enriched form editor definitions
enrichDefinitionWithRichTextOptions()
Enrich a single definition with RTE options for its editors and property collections.
protected
enrichDefinitionWithRichTextOptions(array<string|int, mixed> &$definition) : void
Parameters
- $definition : array<string|int, mixed>
enrichEditorsWithRichTextOptions()
Enrich editors array with RTE options if enableRichtext is set.
protected
enrichEditorsWithRichTextOptions(array<string|int, mixed> &$editors) : void
Iterates through all editors and adds RTE configuration options to textarea editors that have rich text enabled.
Parameters
- $editors : array<string|int, mixed>
enrichPropertyCollectionsWithRichTextOptions()
Enrich property collections (e.g., finishers, validators) with RTE options.
protected
enrichPropertyCollectionsWithRichTextOptions(array<string|int, mixed> &$propertyCollections) : void
Property collections have an additional numeric level in their structure: propertyCollections -> collectionName (e.g., 'finishers') -> numeric index -> editors
Parameters
- $propertyCollections : array<string|int, mixed>
resolveRichTextOptions()
Resolve CKEditor configuration options for the given editor.
protected
resolveRichTextOptions(array<string|int, mixed> $editor) : array<string|int, mixed>
Retrieves the RTE preset configuration and resolves it into a complete CKEditor configuration that can be used in the form editor.
Parameters
- $editor : array<string|int, mixed>
Return values
array<string|int, mixed>shouldEnrichEditorWithRichText()
Check if an editor should be enriched with RTE options.
protected
shouldEnrichEditorWithRichText(array<string|int, mixed> $editor) : bool
An editor qualifies for RTE enrichment if it is a textarea editor and has the enableRichtext flag set to true.
Parameters
- $editor : array<string|int, mixed>