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\CMS\Core\MetaTag\MetaTagManagerRegistry->registerManager() is now a no-op. Calling the method has no effect anymore. The method will be removed in TYPO3 v16.0.
  • The method removeAllManagers() has been removed from MetaTagManagerRegistry , since the list of managers is compiled into the dependency injection container and cannot be changed at runtime anymore.
  • The methods addProperty() , removeProperty() and removeAllProperties() of \TYPO3\CMS\Core\MetaTag\MetaTagManagerInterface now declare a native void return type.

Impact 

Meta tag managers registered via MetaTagManagerRegistry->registerManager() 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 MetaTagManagerInterface directly without the adapted method signatures will cause a fatal PHP error. Classes extending \TYPO3\CMS\Core\MetaTag\AbstractMetaTagManager are only affected if they override one of the changed methods.

Affected installations 

All installations with custom extensions registering meta tag managers via MetaTagManagerRegistry->registerManager() , or providing custom implementations of MetaTagManagerInterface . The extension scanner reports usages of the changed methods as weak match.

Migration 

Remove the MetaTagManagerRegistry->registerManager() call from ext_localconf.php and add the #[AsMetaTagManager] attribute to the manager class instead:

EXT:my_extension/Classes/MetaTag/MyMetaTagManager.php
use TYPO3\CMS\Core\Attribute\AsMetaTagManager;
use TYPO3\CMS\Core\MetaTag\AbstractMetaTagManager;

#[AsMetaTagManager(identifier: 'my-manager')]
final class MyMetaTagManager extends AbstractMetaTagManager
{
    // ...
}
Copied!

Move the manager name previously passed as the first argument to registerManager() 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.