Skip to content
Snippets Groups Projects
Commit 20337e91 authored by Paul Ilea's avatar Paul Ilea
Browse files

[TASK] Accept only alphanumeric values for forms marker names

parent 562c4ea5
No related branches found
No related tags found
No related merge requests found
......@@ -83,9 +83,13 @@ class FormsFinisher extends AbstractFinisher {
$formElementProperties = $formElement->getProperties();
if (isset($formElementProperties['markerName']) && \trim($formElementProperties['markerName']) !== '') {
$markers[\trim($formElementProperties['markerName'])] = $value;
$markerName = \trim($formElementProperties['markerName']);
} else {
$markers[$identifier] = $value;
$markerName = $identifier;
}
$markerName = preg_replace('/[^a-zA-Z0-9]/', '', $markerName);
if (!isset($markers[$markerName])) {
$markers[$markerName] = $value;
}
}
......
......@@ -168,13 +168,22 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
if (isset($element['properties']['markerName']) && $element['properties']['markerName'] !== '') {
$markerName = $element['properties']['markerName'];
}
$markers[] = [
'identifier' => $markerName,
'type' => MailTemplateService::MARKER_TYPE_STRING,
'value' => $element['label'],
'description' => $element['label']
];
$markerName = preg_replace('/[^a-zA-Z0-9]/', '', $markerName);
$duplicateMarker = FALSE;
foreach ($markers as $marker) {
if ($marker['identifier'] === $markerName) {
$duplicateMarker = TRUE;
break;
}
}
if (!$duplicateMarker) {
$markers[] = [
'identifier' => $markerName,
'type' => MailTemplateService::MARKER_TYPE_STRING,
'value' => $element['label'],
'description' => $element['label']
];
}
}
$registrationService = $this->objectManager->get(RegisterService::class);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment