TYPO3 CMS  TYPO3_7-6
Configuration.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
19 {
25  protected $interceptors = [];
26 
33  public function addInterceptor(\TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface $interceptor)
34  {
35  foreach ($interceptor->getInterceptionPoints() as $interceptionPoint) {
36  if (!isset($this->interceptors[$interceptionPoint])) {
37  $this->interceptors[$interceptionPoint] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class);
38  }
39  if (!$this->interceptors[$interceptionPoint]->contains($interceptor)) {
40  $this->interceptors[$interceptionPoint]->attach($interceptor);
41  }
42  }
43  }
44 
51  public function getInterceptors($interceptionPoint)
52  {
53  if (isset($this->interceptors[$interceptionPoint]) && $this->interceptors[$interceptionPoint] instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage) {
54  return $this->interceptors[$interceptionPoint];
55  }
56  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class);
57  }
58 }
addInterceptor(\TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface $interceptor)