Parsers for soft references <t3coreapi:soft-references> can now be
registered via dependency injection in the corresponding
Configuration/Services.(yaml|php) file of your extension. This is done
by tagging your class with the new tag name softreference.parser and
providing the parser key for the attribute parserKey.
In addition, parsers now have to implement
TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserInterface.
This interface describes the parse() method, which is very similar to
the old method findRef(). The difference is that $parserKey (former
known as $spKey) and $parameters (former known as $spParams) can
now be optionally set with the setParserKey() method. The key can be
retrieved with the getParserKey() method.
The return type has also been changed to
TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult.
This model holds the former result array key entries content and
elements as properties and has appropriate getter methods for them. It
should be created by its own factory method
SoftReferenceParserResult::create(), which expects both
above-mentioned arguments to be provided. If the result is empty,
SoftReferenceParserResult::createWithoutMatches() should be used
instead.
Impact
Developers can register their user-defined soft reference parsers in
their Configuration/Services.(yaml|php) file. In addition, parser have
to implement the new interface
TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserInterface.
Feature: #94741 - Register SoftReference parsers via DI
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Feature-94741-RegisterSoftReferenceParsersViaDI.html
Feature: #94741 - Register SoftReference parsers via DI
See 94741
Description
Parsers for
soft references <t3coreapi:soft-references>
can now be registered via dependency injection in the correspondingConfiguration/Services.(yaml|php)
file of your extension. This is done by tagging your class with the new tag namesoftreference.parser
and providing the parser key for the attributeparserKey
.Example:
In addition, parsers now have to implement
TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserInterface
. This interface describes theparse()
method, which is very similar to the old methodfindRef()
. The difference is that$parserKey
(former known as$spKey
) and$parameters
(former known as$spParams
) can now be optionally set with thesetParserKey()
method. The key can be retrieved with thegetParserKey()
method.The return type has also been changed to
TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult
. This model holds the former result array key entriescontent
andelements
as properties and has appropriate getter methods for them. It should be created by its own factory methodSoftReferenceParserResult::create()
, which expects both above-mentioned arguments to be provided. If the result is empty,SoftReferenceParserResult::createWithoutMatches()
should be used instead.Impact
Developers can register their user-defined soft reference parsers in their
Configuration/Services.(yaml|php)
file. In addition, parser have to implement the new interfaceTYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserInterface
.Related
RegisterSoftReferenceParsersViaDI (Deprecation) <Deprecation-94741-RegisterSoftReferenceParsersViaDI>
SoftReferenceIndex (Deprecation) <Deprecation-94687-SoftReferenceIndex>