• Nikita Hovratov's avatar
    [FEATURE] Register SoftReference parsers via DI · 48810cb7
    Nikita Hovratov authored and Benni Mack's avatar Benni Mack committed
    The concept for registration and usage of soft reference parsers
    received a complete overhaul.
    
    Starting with the registration, it is now possible to register soft
    reference parsers by dependency injection in the extension's
    Services.(yaml|php) file. For this, the new tag name
    "softreference.parser" has been introduced. One has to provide the
    additional attribute "parserKey" to identify the parser. This
    replaces the old way of registering these parsers in the $GLOBALS
    array. If a parser is registered with the same key in both ways,
    the old way takes precedence for b/w compatibility.
    
    This comes with a completely new factory service class
    TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserFactory.
    This classes' responsibilities are collecting all registered soft
    reference parsers and serving them to the consumer by calling the
    method "getSoftReferenceParser" with the desired parser key as the
    only argument. There is a compatibility layer for the old way of
    registration and for classes not implementing the new interface.
    
    Soft reference parsers now have to implement
    TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserInterface.
    The interface defines the implementation of the "parse" method.
    The first 4 and the last parameter stay the same as in the old method
    "findRef". The remaining two parameters "spKey" and "spParams" have to
    be set with the "setParserKey" method, if they are needed. The key can
    be retrieved by using the "getParserKey" method.
    
    The different parser implementations in the old class
    TYPO3\CMS\Core\Database\SoftReferenceIndex have been extracted and
    moved into dedicated classes in the
    TYPO3\CMS\Core\DataHandling\SoftReference namespace. Missing tests
    for parsers other than "typolink" and "typolink_tag" are added.
    
    The method makeTokenID of SoftReferenceIndex has been moved into
    TYPO3\CMS\Core\DataHandling\SoftReference\AbstractSoftReferenceParser.
    A parser can extend this abstract class, if this method is needed.
    
    The methods of BackendUtility "softRefParserObj" and
    "explodeSoftRefParserList" are now deprecated and the replacement
    TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserFactory
    should be used instead.
    
    Resolves: #94687
    Resolves: #94741
    Releases: master
    Change-Id: I460bfdd4478194fa4b4111fc44871f7225c6c084
    Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70177
    
    Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
    Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
    Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
    Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
    Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
    48810cb7