|
11 | 11 | use TYPO3\CMS\Backend\Utility\BackendUtility as BackendUtilityCore;
|
12 | 12 | use TYPO3\CMS\Core\Utility\GeneralUtility;
|
13 | 13 | use TYPO3\CMS\Extbase\Object\Exception;
|
14 |
| -use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper; |
15 | 14 |
|
16 | 15 | /**
|
17 | 16 | * Class CreateMarker to autofill field marker with value from title e.g. {firstname}
|
@@ -238,13 +237,20 @@ protected function addNewFields(): void
|
238 | 237 | */
|
239 | 238 | protected function getFieldObjectFromProperties(array $properties, string $uid = '0'): Field
|
240 | 239 | {
|
241 |
| - $dataMapper = GeneralUtility::makeInstance(DataMapper::class); |
242 |
| - if (isset($properties['uid']) === false) { |
243 |
| - $properties['uid'] = null; |
| 240 | + $field = GeneralUtility::makeInstance(Field::class); |
| 241 | + $properties['contentelement'] = (int)($properties['contentelement'] ?? 0); |
| 242 | + $properties['validation'] = (int)($properties['validation'] ?? 0); |
| 243 | + $properties['multiselect'] = (bool)($properties['multiselect'] ?? false); |
| 244 | + $properties['sender_name'] = (bool)($properties['sender_name'] ?? false); |
| 245 | + $properties['sender_email'] = (bool)($properties['sender_email'] ?? false); |
| 246 | + $properties['mandatory'] = (bool)($properties['mandatory'] ?? false); |
| 247 | + $properties['sorting'] = (int)($properties['sorting'] ?? 0); |
| 248 | + $properties['l10n_parent'] = (int)($properties['l10n_parent'] ?? 0); |
| 249 | + foreach ($properties as $key => $value) { |
| 250 | + $field->_setProperty(GeneralUtility::underscoredToLowerCamelCase($key), $value); |
244 | 251 | }
|
245 |
| - $field = $dataMapper->map(Field::class, [$properties])[0]; |
246 | 252 | if (!empty($properties['sys_language_uid'])) {
|
247 |
| - $field->_setProperty('_languageUid', (int)$properties['sys_language_uid']); |
| 253 | + $field->_setProperty('_languageUid', $properties['sys_language_uid']); |
248 | 254 | }
|
249 | 255 | $field->setDescription((string)($properties['uid'] ?? '') > 0 ? (string)$properties['uid'] : $uid);
|
250 | 256 | return $field;
|
|
0 commit comments