Feature: #76107 - Add fluid interceptor registration
See forge#76107
Description
Interceptors in Fluid Standalone have been introduced to be able to change the template output. The Fluid API already allows for registration of custom interceptors. Now it is possible to define custom interceptors via the following option:
$GLOBALS['TYPO3_CONF_VARS']['fluid']['interceptors']
Copied!
Interceptors registered here are added to the Fluid parser configuration.
Impact
Extensions are able to register custom interceptors using the available configuration in
$TYPO3_
.
Registered classes have to implement the \TYPO3Fluid\
.
// Register an own interceptor to fluid parser configuration
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['interceptors'][\TYPO3\CMS\Fluid\Core\Parser\Interceptor\DebugInterceptor::class] =
\TYPO3\CMS\Fluid\Core\Parser\Interceptor\DebugInterceptor::class;
Copied!
use TYPO3Fluid\Fluid\Core\Parser\InterceptorInterface;
use TYPO3Fluid\Fluid\Core\Parser\ParsingState;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface;
class DebugInterceptor implements InterceptorInterface
{
public function process(NodeInterface $node, $interceptorPosition, ParsingState $parsingState) : NodeInterface
{
return $node;
}
public function getInterceptionPoints()
{
return [];
}
}
Copied!