TYPO3 CMS  TYPO3_8-7
CreatableFormElementPropertiesValidator.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 
19 
24 {
25 
35  public function __invoke(string $key, $value)
36  {
37  $dto = $this->validationDto->withPropertyPath($key);
38 
39  if (!$this->getConfigurationService()->isFormElementPropertyDefinedInFormEditorSetup($dto)) {
40  if ($this->getConfigurationService()->isFormElementPropertyDefinedInPredefinedDefaultsInFormEditorSetup($dto)) {
41  $predefinedDefaultValue = $this->getConfigurationService()->getFormElementPredefinedDefaultValueFromFormEditorSetup($dto);
42  if ($value !== $predefinedDefaultValue) {
43  $message = 'The value "%s" of property "%s" (form element "%s") is not equal to the default value "%s" #1528588035';
44  throw new PropertyException(
45  sprintf(
46  $message,
47  $value,
48  $dto->getPropertyPath(),
49  $dto->getFormElementIdentifier(),
50  $predefinedDefaultValue
51  ),
52  1528588035
53  );
54  }
55  } else {
57  $this->currentElement,
58  $value,
59  $this->sessionToken,
60  $dto
61  );
62  }
63  }
64  }
65 }
validateFormElementPropertyValueByHmacData(array $currentElement, $value, string $sessionToken, ValidationDto $dto)