‪TYPO3CMS  10.4
OnTheFly.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 
21 
27 {
31  protected ‪$providerList = [];
32 
40  public function ‪compile(array $result)
41  {
42  if (empty($this->providerList)) {
43  throw new \UnexpectedValueException(
44  'Data provider list is empty, call setProviderList first',
45  1441108674
46  );
47  }
48 
49  foreach ($this->providerList as $providerClassName) {
51  $provider = GeneralUtility::makeInstance($providerClassName);
52 
53  if (!$provider instanceof ‪FormDataProviderInterface) {
54  throw new \UnexpectedValueException(
55  'Data provider ' . $providerClassName . ' must implement FormDataProviderInterface',
56  1441108719
57  );
58  }
59 
60  $result = $provider->addData($result);
61  }
62 
63  return $result;
64  }
65 
71  public function ‪setProviderList(array $list)
72  {
73  $this->providerList = $list;
74  }
75 }
‪TYPO3\CMS\Backend\Form\FormDataGroup
Definition: FlexFormSegment.php:16
‪TYPO3\CMS\Backend\Form\FormDataGroup\OnTheFly
Definition: OnTheFly.php:27
‪TYPO3\CMS\Backend\Form\FormDataGroup\OnTheFly\compile
‪array compile(array $result)
Definition: OnTheFly.php:39
‪TYPO3\CMS\Backend\Form\FormDataGroupInterface
Definition: FormDataGroupInterface.php:23
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:23
‪TYPO3\CMS\Backend\Form\FormDataGroup\OnTheFly\setProviderList
‪setProviderList(array $list)
Definition: OnTheFly.php:70
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Backend\Form\FormDataGroup\OnTheFly\$providerList
‪string[] $providerList
Definition: OnTheFly.php:30