‪TYPO3CMS  ‪main
IsCreatableFormElementExtractor.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 {
31  public function ‪__invoke(string $_, $value, array $matches)
32  {
33  [, $formElementType] = $matches;
34 
35  $formElementGroup = $value;
36 
37  $result = $this->extractorDto->getResult();
38 
40  $this->extractorDto->getPrototypeConfiguration(),
41  'formElementsDefinition.' . $formElementType . '.formEditor.groupSorting',
42  '.'
43  )) {
44  $result['formElements'][$formElementType]['creatable'] = false;
45  $this->extractorDto->setResult($result);
46  return;
47  }
48 
49  $formElementGroups = array_keys(
50  ‪ArrayUtility::getValueByPath($this->extractorDto->getPrototypeConfiguration(), 'formEditor.formElementGroups', '.')
51  );
52 
53  $result['formElements'][$formElementType]['creatable'] = in_array(
54  $formElementGroup,
55  $formElementGroups,
56  true
57  );
58 
59  $this->extractorDto->setResult($result);
60  }
61 }
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\IsCreatableFormElementExtractor\__invoke
‪__invoke(string $_, $value, array $matches)
Definition: IsCreatableFormElementExtractor.php:31
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\AbstractExtractor
Definition: AbstractExtractor.php:24
‪TYPO3\CMS\Core\Utility\ArrayUtility\isValidPath
‪static bool isValidPath(array $array, array|string $path, string $delimiter='/')
Definition: ArrayUtility.php:141
‪TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath
‪static getValueByPath(array $array, array|string $path, string $delimiter='/')
Definition: ArrayUtility.php:176
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement
Definition: IsCreatableFormElementExtractor.php:18
‪TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\IsCreatableFormElementExtractor
Definition: IsCreatableFormElementExtractor.php:27
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:26