‪TYPO3CMS  9.5
OrderedProviderList.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
22 
30 {
34  protected ‪$providerList = [];
35 
43  public function ‪compile(array $result): array
44  {
45  $orderingService = GeneralUtility::makeInstance(DependencyOrderingService::class);
46  $orderedDataProvider = $orderingService->orderByDependencies($this->providerList, 'before', 'depends');
47 
48  foreach ($orderedDataProvider as $providerClassName => $providerConfig) {
49  if (isset($providerConfig['disabled']) && $providerConfig['disabled'] === true) {
50  // Skip this data provider if disabled by configuration
51  continue;
52  }
53 
55  $provider = GeneralUtility::makeInstance($providerClassName);
56 
57  if (!$provider instanceof ‪FormDataProviderInterface) {
58  throw new \UnexpectedValueException(
59  'Data provider ' . $providerClassName . ' must implement FormDataProviderInterface',
60  1485299408
61  );
62  }
63 
64  $result = $provider->addData($result);
65  }
66 
67  return $result;
68  }
69 
83  public function ‪setProviderList(array $list)
84  {
85  $this->providerList = $list;
86  }
87 }
‪TYPO3\CMS\Backend\Form\FormDataGroup
Definition: FlexFormSegment.php:2
‪TYPO3\CMS\Backend\Form\FormDataGroup\OrderedProviderList\$providerList
‪FormDataProviderInterface[] $providerList
Definition: OrderedProviderList.php:33
‪TYPO3\CMS\Backend\Form\FormDataGroup\OrderedProviderList\compile
‪array compile(array $result)
Definition: OrderedProviderList.php:42
‪TYPO3\CMS\Backend\Form\FormDataGroup\OrderedProviderList
Definition: OrderedProviderList.php:30
‪TYPO3\CMS\Backend\Form\FormDataGroup\OrderedProviderList\setProviderList
‪setProviderList(array $list)
Definition: OrderedProviderList.php:82
‪TYPO3\CMS\Core\Service\DependencyOrderingService
Definition: DependencyOrderingService.php:31
‪TYPO3\CMS\Backend\Form\FormDataGroupInterface
Definition: FormDataGroupInterface.php:22
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:22
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45