Commit 241282f1 authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Benni Mack
Browse files

[BUGFIX] Hash identifier of Flexform sections

To avoid issues with Flexform section identifiers having any reserved
character in CSS context, e.g. a dot, the identifier is now hashed to
be able to find the container via `querySelector()`.

Resolves: #94541
Releases: master
Change-Id: Id2a63ae679e024835284672b2121af9003e58f51
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69815

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: default avatarGuido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 98a059e8
......@@ -72,6 +72,7 @@ class FlexFormSectionContainer extends AbstractContainer
$containerId = sprintf('flexform-section-container-%s-%s', $this->data['fieldName'], $flexFormFieldName);
$sectionContainerId = sprintf('flexform-section-%s-%s', $this->data['fieldName'], $flexFormFieldName);
$hashedSectionContainerId = 'section-' . md5($sectionContainerId);
// "New container" handling: Creates buttons for each possible container with all relevant information for the ajax call.
$containerTemplatesHtml = [];
......@@ -95,7 +96,7 @@ class FlexFormSectionContainer extends AbstractContainer
$containerTemplateHtml[] = 'data-flexformsheetname="' . htmlspecialchars($flexFormSheetName) . '"';
$containerTemplateHtml[] = 'data-flexformfieldname="' . htmlspecialchars($flexFormFieldName) . '"';
$containerTemplateHtml[] = 'data-flexformcontainername="' . htmlspecialchars($flexFormContainerName) . '"';
$containerTemplateHtml[] = 'data-target="#' . htmlspecialchars($sectionContainerId) . '"';
$containerTemplateHtml[] = 'data-target="#' . htmlspecialchars($hashedSectionContainerId) . '"';
$containerTemplateHtml[] = '>';
$containerTemplateHtml[] = $iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render();
$containerTemplateHtml[] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($containerTitle, 30));
......@@ -122,7 +123,7 @@ class FlexFormSectionContainer extends AbstractContainer
$html = [];
$html[] = '<div class="panel panel-tab">';
$html[] = '<div class="panel-body">';
$html[] = '<div class="t3-form-field-container t3-form-flex" id="' . htmlspecialchars($containerId) . '" data-section="#' . htmlspecialchars($sectionContainerId) . '">';
$html[] = '<div class="t3-form-field-container t3-form-flex" id="' . htmlspecialchars($containerId) . '" data-section="#' . htmlspecialchars($hashedSectionContainerId) . '">';
$html[] = '<div class="t3-form-field-label-flexsection">';
$html[] = '<h4>';
$html[] = htmlspecialchars($sectionTitle);
......@@ -134,7 +135,7 @@ class FlexFormSectionContainer extends AbstractContainer
$html[] = '</button>';
$html[] = '</div>';
$html[] = '<div';
$html[] = 'id="' . htmlspecialchars($sectionContainerId) . '"';
$html[] = 'id="' . htmlspecialchars($hashedSectionContainerId) . '"';
$html[] = 'class="panel-group panel-hover t3-form-field-container-flexsection t3-flex-container"';
$html[] = 'data-t3-flex-allow-restructure="' . ($userHasAccessToDefaultLanguage ? '1' : '0') . '"';
$html[] = '>';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment