‪TYPO3CMS  10.4
ContentDataProcessor.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 
25 {
35  public function ‪process(‪ContentObjectRenderer $cObject, array $configuration, array $variables)
36  {
37  if (
38  !empty($configuration['dataProcessing.'])
39  && is_array($configuration['dataProcessing.'])
40  ) {
41  $processors = $configuration['dataProcessing.'];
42  $processorKeys = ‪ArrayUtility::filterAndSortByNumericKeys($processors);
43 
44  foreach ($processorKeys as $key) {
45  $className = $processors[$key];
46  if (!class_exists($className)) {
47  throw new \UnexpectedValueException('Processor class name "' . $className . '" does not exist!', 1427455378);
48  }
49 
50  if (!in_array(DataProcessorInterface::class, class_implements($className), true)) {
51  throw new \UnexpectedValueException(
52  'Processor with class name "' . $className . '" ' .
53  'must implement interface "' . DataProcessorInterface::class . '"',
54  1427455377
55  );
56  }
57 
58  $processorConfiguration = $processors[$key . '.'] ?? [];
59 
60  $variables = GeneralUtility::makeInstance($className)->process(
61  $cObject,
62  $configuration,
63  $processorConfiguration,
64  $variables
65  );
66  }
67  }
68 
69  return $variables;
70  }
71 }
‪TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor
Definition: ContentDataProcessor.php:25
‪TYPO3\CMS\Frontend\ContentObject
Definition: AbstractContentObject.php:16
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:24
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:97
‪TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor\process
‪array process(ContentObjectRenderer $cObject, array $configuration, array $variables)
Definition: ContentDataProcessor.php:35
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Core\Utility\ArrayUtility\filterAndSortByNumericKeys
‪static array filterAndSortByNumericKeys($setupArr, $acceptAnyKeys=false)
Definition: ArrayUtility.php:844