Bug #57824
closedPalette fields are not wrapped, because --linebreak-- values are removed
0%
Description
A statement like this in ext_tables.php:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('pages', 'myPalette', 'tx_myext_myfield1, --linebreak--, tx_myext_myfield2, --linebreak--, tx_myext_myfield2, --linebreak--, tx_myext_myfield3');
is not interpreted correctly. The method \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::removeDuplicatesForInsertion() removes all duplicated fields, including the "--linebreak--"s on line 643:
$insertionList = implode(', ', array_unique($insertionListParts));
Only the first "--linebreak--" is kept.
Files
Updated by Christian Ludwig about 10 years ago
- Target version set to next-patchlevel
A fixed method could look like this.
static protected function removeDuplicatesForInsertion($insertionList, $list = '') { $insertionListParts = preg_split('/\\s*,\\s*/', $insertionList); $cleanInsertionListParts = array(); foreach ($insertionListParts as $fieldName) { if ($fieldName == '--linebreak--' || !in_array($fieldName, $cleanInsertionListParts)) { $cleanInsertionListParts[] = $fieldName; } } $cleanInsertionList = implode(', ', $cleanInsertionListParts); if ($list === '') { return $cleanInsertionList; } // Get a list of fieldNames that are present in the list. preg_match_all('/(?:^|,)\\s*\\b([^;,]+)\\b[^,]*/', $list, $listMatches); // Remove the field names from the insertionlist. $fieldReplacePatterns = array(); foreach ($listMatches[1] as $fieldName) { if ($fieldName != '--linebreak--') { $fieldReplacePatterns[] = '/(?:^|,)\\s*\\b' . preg_quote($fieldName, '/') . '\\b[^,$]*/'; } } return preg_replace($fieldReplacePatterns, '', $cleanInsertionList); }
Anyway I think this method is incomplete because it does not check for duplicate fields respecting all palettes and normal fields. So imho its call could be removed from addFieldsToPalette() and executePositionedStringInsertion() what would fix the problem too.
Updated by Christian Ludwig about 10 years ago
- File patch-1.patch patch-1.patch added
Updated by Christian Ludwig about 10 years ago
- File patch-2.patch patch-2.patch added
Sorry, swaped direction in patch-1.patch.
Please use patch-2.patch!
Updated by Gerrit Code Review about 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019
Updated by Christian Ludwig about 10 years ago
Please review the patch http://review.typo3.org/34019 (it is refactored compared to the ones posted here) so it can be part of the next minor release of v6.2.
Infos about how to review can be found here http://wiki.typo3.org/Contribute_Walkthrough
Updated by Gerrit Code Review about 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019
Updated by Gerrit Code Review about 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019
Updated by Gerrit Code Review about 10 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019
Updated by Gerrit Code Review about 10 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019
Updated by Gerrit Code Review almost 10 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35745
Updated by Wouter Wolters almost 10 years ago
- Description updated (diff)
- Status changed from Under Review to Resolved
Updated by Kai Möller over 9 years ago
The commit breaks flexform configuration as described in Bug #65480