Breaking: #110287 - Meta tag manager registration and interface changed
See forge#110287
Description
Meta tag managers are now registered as tagged services via dependency injection (see Feature: #110287 - Register meta tag managers as tagged services). This comes with the following breaking changes:
\TYPO3\is now a no-op. Calling the method has no effect anymore. The method will be removed in TYPO3 v16.0.CMS\ Core\ Meta Tag\ Meta Tag Manager Registry->register Manager () - The method
removehas been removed fromAll Managers () Meta, since the list of managers is compiled into the dependency injection container and cannot be changed at runtime anymore.Tag Manager Registry - The methods
add,Property () removeandProperty () removeofAll Properties () \TYPO3\now declare a nativeCMS\ Core\ Meta Tag\ Meta Tag Manager Interface voidreturn type.
Impact
Meta tag managers registered via
Meta in
ext_localconf.php are no longer evaluated: their meta tag
properties are handled by the generic meta tag manager until the manager
is registered as a tagged service.
Custom classes implementing
Meta directly
without the adapted method signatures will cause a fatal PHP error.
Classes extending
\TYPO3\
are only affected if they override one of the changed methods.
Affected installations
All installations with custom extensions registering meta tag managers
via
Meta, or providing custom
implementations of
Meta. The extension scanner
reports usages of the changed methods as weak match.
Migration
Remove the
Meta call from
ext_localconf.php and add the
#
attribute to the manager class instead:
use TYPO3\CMS\Core\Attribute\AsMetaTagManager;
use TYPO3\CMS\Core\MetaTag\AbstractMetaTagManager;
#[AsMetaTagManager(identifier: 'my-manager')]
final class MyMetaTagManager extends AbstractMetaTagManager
{
// ...
}
Move the manager name previously passed as the first argument to
register to the
identifier
argument of the
attribute, and any
before
/
after
arguments to the
corresponding attribute arguments.
In case the extension supports both TYPO3 v14 and v15, register the
manager in both ways: the ext_localconf.php registration is
evaluated in v14, the attribute in v15. The
void
return type
declarations are compatible with both versions.