‪TYPO3CMS  11.5
MultiValuePropertiesExtractor.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 
22 
27 {
33  public function ‪__invoke(string $_, $value, array $matches)
34  {
35  [, $formElementType, $formEditorIndex] = $matches;
36 
37  if (
38  $value !== 'Inspector-PropertyGridEditor'
39  && $value !== 'Inspector-MultiSelectEditor'
40  && $value !== 'Inspector-ValidationErrorMessageEditor'
41  && $value !== 'Inspector-RequiredValidatorEditor'
42  ) {
43  return;
44  }
45 
46  if ($value === 'Inspector-RequiredValidatorEditor') {
47  $propertyPath = implode(
48  '.',
49  [
50  'formElementsDefinition',
51  $formElementType,
52  'formEditor',
53  'editors',
54  $formEditorIndex,
55  'configurationOptions',
56  'validationErrorMessage',
57  'propertyPath',
58  ]
59  );
60  } else {
61  $propertyPath = implode(
62  '.',
63  [
64  'formElementsDefinition',
65  $formElementType,
66  'formEditor',
67  'editors',
68  $formEditorIndex,
69  'propertyPath',
70  ]
71  );
72  }
73 
74  $result = $this->extractorDto->getResult();
75 
76  if (‪ArrayUtility::isValidPath($this->extractorDto->getPrototypeConfiguration(), $propertyPath, '.')) {
77  $result['formElements'][$formElementType]['multiValueProperties'][] = ‪ArrayUtility::getValueByPath(
78  $this->extractorDto->getPrototypeConfiguration(),
79  $propertyPath,
80  '.'
81  );
82  }
83 
84  if ($value === 'Inspector-PropertyGridEditor') {
85  $result['formElements'][$formElementType]['multiValueProperties'][] = 'defaultValue';
86  }
87 
88  $this->extractorDto->setResult($result);
89  }
90 }
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\MultiValuePropertiesExtractor
Definition: MultiValuePropertiesExtractor.php:27
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\AbstractExtractor
Definition: AbstractExtractor.php:24
‪TYPO3\CMS\Core\Utility\ArrayUtility\isValidPath
‪static bool isValidPath(array $array, $path, $delimiter='/')
Definition: ArrayUtility.php:144
‪TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath
‪static mixed getValueByPath(array $array, $path, $delimiter='/')
Definition: ArrayUtility.php:180
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement
Definition: IsCreatableFormElementExtractor.php:18
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:24
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\MultiValuePropertiesExtractor\__invoke
‪__invoke(string $_, $value, array $matches)
Definition: MultiValuePropertiesExtractor.php:33