Issue Feature Under Review Orphaned

#109143Inspector Editor Registry for the Form Framework

Josua Vogel 03/03/26, 19:04 updated 03/04/26, 16:28

Description

The TYPO3 form framework’s backend editor uses “inspector editors” — configurable UI widgets that allow editors to modify form element properties (text fields, select lists, property grids, etc.). The behavior of these editors is currently defined implicitly through YAML `templateName` values, with the corresponding PHP logic hard-coded across multiple extractor classes.

This creates two key problems:

  1. Extension developers cannot create custom inspector editors with multi-value property support.** The framework only recognizes a fixed list of five `templateName` values as multi-value capable. Any custom editor that handles arrays, key/value pairs, or dynamic option sets is rejected by the form definition validation — there is no way to register new multi-value editors.
  2. Editor behavior is scattered and duplicated.** Whether an editor supports multi-value properties, rich text, or collection scoping is determined by `if/else` chains checking `templateName` strings in at least six different PHP files. Adding or changing editor behavior requires modifications in multiple unrelated locations.

Proposed Solution

Introduce a PHP-based inspector editor registry that allows each inspector editor to be represented as a PHP class declaring its own capabilities. The registry replaces all hard-coded `templateName` checks with a single lookup mechanism.

Core Concepts

  • PHP attribute for registration: A new `#[AsFormInspectorEditor]` attribute marks a class as an inspector editor. The Symfony DI container discovers and collects these classes automatically at compile time — no manual `Services.yaml` wiring needed.
  • `InspectorEditorInterface`: Each editor class implements a contract that describes its behavior: * Which property paths have multi-value semantics * Whether multi-value properties are scoped to validator/finisher collections * Whether the editor supports CKEditor rich text * How property paths with placeholders are expanded to concrete paths * How select option paths are resolved * Which Fluid partial renders the editor’s HTML
  • `AbstractInspectorEditor` base class: Provides sensible defaults so that simple editors only need to implement `getFluidPartialName()`. Complex editors override specific methods to declare their behavior.
  • `InspectorEditorRegistry`: A central, immutable registry populated at container compile time. All extractors and services query this registry instead of checking `templateName` strings directly.

What Changes for Existing Code

  • All existing extractor classes (`MultiValuePropertiesExtractor`, `SelectOptionsExtractor`, `IsCreatablePropertyCollectionElementExtractor`, `PropertyPathsExtractor`, etc.) are refactored to use the registry instead of hard-coded conditionals.
  • The `FormDefinitionConversionService` and `FormEditorEnrichmentService` use the registry for rich text detection and partial resolution.
  • All 17 built-in inspector editors are migrated to PHP classes.

What Changes for Extension Developers

  • Custom inspector editors can now fully participate in multi-value property validation, rich text enrichment, and property path processing by implementing the interface.
  • The `formEditorPartials` YAML key becomes unnecessary for inspector editors — the Fluid partial path is resolved from the PHP class. Existing YAML entries still work but are deprecated.
  • The existing YAML-based `templateName` configuration remains the way editors are referenced in form definitions. The PHP class is purely additive metadata.

Backward Compatibility

  • All existing YAML form configurations continue to work without changes.
  • Editors not found in the registry fall back to the previous behavior (property path used as-is, no multi-value support). This ensures third-party editors that have not yet migrated to the new mechanism remain functional.
  • `Inspector-*` entries in `formEditorPartials` trigger a deprecation log and will be removed in v15. Non-inspector entries (`FormElement-*`, `Modal-*`) are unaffected.

Reviews 1

History 17