Feature: #107784 - Autoconfigure backend layout data providers
See forge#107784
Description
Backend layout providers are now autoconfigured once they implement the required
Data. Each
autoconfigured layout provider is tagged with
page_ in the service container and is automatically added
to the global
Data,
if autoconfiguration is enabled in Services. or
Services..
Since backend layout providers must be identifiable to establish a relation to
a configured backend layout, the corresponding interface has been extended.
It now requires backend layout providers to implement a new method
get.
Example
use TYPO3\CMS\Backend\View\BackendLayout\DataProviderInterface;
final class MyLayoutDataProvider implements DataProviderInterface
{
// ...
public function getIdentifier(): string
{
return 'my_provider';
}
}
Important
The identifier returned by
get must:
- Be a non-empty string
- Not contain double underscores (
__) (used as a separator for combined identifiers) - Be unique across all registered backend layout data providers
Example of a combined identifier:
my_
Manual service configuration
If autoconfiguration is disabled, manually tag the service in
Services.:
services:
MyVendor\MyExtension\View\BackendLayout\MyLayoutDataProvider:
tags:
- name: page_layout.data_provider
Provider ordering
If you need to control the order in which providers are processed, use service
priorities in your Services.:
services:
MyVendor\MyExtension\View\BackendLayout\MyLayoutDataProvider:
tags:
- name: page_layout.data_provider
priority: 100
Impact
Backend layout data providers are now automatically registered and can be used
without further configuration. This improves developer experience and reduces
configuration overhead. The previous registration method via
$GLOBALS
can no longer be used. Instead, existing backend layout providers must
implement the new method
get.
Using the new autoconfigure-based approach, developers can still support multiple TYPO3 Core versions by keeping the legacy array-based approach next to the new autoconfigure-based configuration.