‪TYPO3CMS  10.4
OrderedProviderList.php
Go to the documentation of this file.
1 <?php
2 
3 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 
19 
24 
32 {
36  protected ‪$providerList = [];
37 
45  public function ‪compile(array $result): array
46  {
47  $orderingService = GeneralUtility::makeInstance(DependencyOrderingService::class);
48  $orderedDataProvider = $orderingService->orderByDependencies($this->providerList, 'before', 'depends');
49 
50  foreach ($orderedDataProvider as $providerClassName => $providerConfig) {
51  if (isset($providerConfig['disabled']) && $providerConfig['disabled'] === true) {
52  // Skip this data provider if disabled by configuration
53  continue;
54  }
55 
57  $provider = GeneralUtility::makeInstance($providerClassName);
58 
59  if (!$provider instanceof ‪FormDataProviderInterface) {
60  throw new \UnexpectedValueException(
61  'Data provider ' . $providerClassName . ' must implement FormDataProviderInterface',
62  1485299408
63  );
64  }
65 
66  $result = $provider->addData($result);
67  }
68 
69  return $result;
70  }
71 
85  public function ‪setProviderList(array $list)
86  {
87  $this->providerList = $list;
88  }
89 }
‪TYPO3\CMS\Backend\Form\FormDataGroup
Definition: FlexFormSegment.php:16
‪TYPO3\CMS\Backend\Form\FormDataGroup\OrderedProviderList\$providerList
‪FormDataProviderInterface[] $providerList
Definition: OrderedProviderList.php:35
‪TYPO3\CMS\Backend\Form\FormDataGroup\OrderedProviderList\compile
‪array compile(array $result)
Definition: OrderedProviderList.php:44
‪TYPO3\CMS\Backend\Form\FormDataGroup\OrderedProviderList
Definition: OrderedProviderList.php:32
‪TYPO3\CMS\Backend\Form\FormDataGroup\OrderedProviderList\setProviderList
‪setProviderList(array $list)
Definition: OrderedProviderList.php:84
‪TYPO3\CMS\Core\Service\DependencyOrderingService
Definition: DependencyOrderingService.php:32
‪TYPO3\CMS\Backend\Form\FormDataGroupInterface
Definition: FormDataGroupInterface.php:23
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:23
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46