TYPO3 CMS  TYPO3_8-7
UnknownFormElement.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 originated from the Neos.Form package (www.neos.io)
9  *
10  * It is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License, either version 2
12  * of the License, or any later version.
13  *
14  * For the full copyright and license information, please read the
15  * LICENSE.txt file that was distributed with this source code.
16  *
17  * The TYPO3 project - inspiring people to share!
18  */
19 
24 
31 {
32 
41  public function __construct(string $identifier, string $type)
42  {
43  if (!is_string($identifier) || strlen($identifier) === 0) {
44  throw new IdentifierNotValidException('The given identifier was not a string or the string was empty.', 1382364370);
45  }
46  $this->identifier = $identifier;
47  $this->type = $type;
48  }
49 
53  public function initializeFormElement()
54  {
55  if (
56  isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/form']['initializeFormElement'])
57  && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/form']['initializeFormElement'])
58  ) {
59  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/form']['initializeFormElement'] as $className) {
60  $hookObj = GeneralUtility::makeInstance($className);
61  if (method_exists($hookObj, 'initializeFormElement')) {
62  $hookObj->initializeFormElement(
63  $this
64  );
65  }
66  }
67  }
68  }
69 
78  public function getUniqueIdentifier(): string
79  {
80  $formDefinition = $this->getRootForm();
81  $uniqueIdentifier = sprintf('%s-%s', $formDefinition->getIdentifier(), $this->identifier);
82  $uniqueIdentifier = preg_replace('/[^a-zA-Z0-9-_]/', '_', $uniqueIdentifier);
83  return lcfirst($uniqueIdentifier);
84  }
85 
92  public function getTemplateName(): string
93  {
94  return 'UnknownElement';
95  }
96 
101  public function getDefaultValue()
102  {
103  return null;
104  }
105 
112  public function setDefaultValue($defaultValue)
113  {
114  }
115 
123  public function setProperty(string $key, $value)
124  {
125  }
126 
131  public function getProperties(): array
132  {
133  return [];
134  }
135 
140  public function isRequired(): bool
141  {
142  return false;
143  }
144 
155  public function onSubmit(FormRuntime $formRuntime, &$elementValue, array $requestArguments = [])
156  {
158  }
159 }
onSubmit(FormRuntime $formRuntime, &$elementValue, array $requestArguments=[])
static makeInstance($className,... $constructorArguments)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']