1
2.. include:: ../../Includes.txt
3
4====================================================
5Feature: #76107 - Add fluid interceptor registration
6====================================================
7
8See :issue:`76107`
9
10Description
11===========
12
13Interceptors in Fluid Standalone have been introduced to be able to change the template output.
14The Fluid API already allows for registration of custom interceptors. Now it is possible to define
15custom interceptors via the following option:
16
17.. code-block:: php
18
19   $GLOBALS['TYPO3_CONF_VARS']['fluid']['interceptors']
20
21Interceptors registered here are added to the Fluid parser configuration.
22
23Impact
24======
25
26Extensions are able to register custom interceptors using the available configuration in :php:`$TYPO3_CONF_VARS[fluid][interceptors]`.
27
28Registered classes have to implement the `\TYPO3Fluid\Fluid\Core\Parser\InterceptorInterface`.
29
30.. code-block:: php
31
32   // Register an own interceptor to fluid parser configuration
33   $GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['interceptors'][\TYPO3\CMS\Fluid\Core\Parser\Interceptor\DebugInterceptor::class] =
34      \TYPO3\CMS\Fluid\Core\Parser\Interceptor\DebugInterceptor::class;
35
36.. code-block:: php
37
38   use TYPO3Fluid\Fluid\Core\Parser\InterceptorInterface;
39   use TYPO3Fluid\Fluid\Core\Parser\ParsingState;
40   use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface;
41
42   class DebugInterceptor implements InterceptorInterface
43   {
44      public function process(NodeInterface $node, $interceptorPosition, ParsingState $parsingState) : NodeInterface
45      {
46         return $node;
47      }
48
49      public function getInterceptionPoints()
50      {
51         return [];
52      }
53   }
54
55.. index:: PHP-API, LocalConfiguration, Fluid
56