Bug #105015
closedLocale aware sorting of foreign records with selectMultipleSideBySide in the backend
100%
Description
in typo3 v10 and v13, I use a selectMultipleSideBySide to which I set sortItems in the TCA :
'thecolumn' => [
'exclude' => 0,
'label' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:sources',
'config' => [
'type' => 'select',
'sortItems' => [
'label' => 'asc',
],
'renderType' => 'selectMultipleSideBySide',
The sort order is managed by the PHP function strcasecmp which only does basic ascii comparision which put accented characters at the end of the list.
This is what I have done locally to fix this ( sorry, not equipped to do a proper pull request )
typo3 10.4.45 /backend/Classes/Form/FormDataProvider/TcaSelectItems.php line 288
typo3 13.2.1 /cms-backend/Classes/Form/Processor/SelectItemProcessor.php line 159
protected function sortItems(array $items, array $sortOrders): array
{
foreach ($sortOrders as $order => $direction) {
switch ($order) {
case 'label':
$direction = strtolower($direction);
* $collator = new \Collator(null);
@usort(
$items,
* function ($item1, $item2) use ($direction, $collator) {
if ($direction === 'desc') {
* return $collator->compare($item1[0], $item2[0]) <= 0;
}
* return $collator->compare($item1[0], $item2[0]);
}
);
break;
This is the first half of the function in typo3 v10, same changes to the other case 'value'.
It's almost the same on typo3 v13.
Updated by Garvin Hicking 2 months ago
- Category changed from Backend User Interface to FormEngine aka TCEforms
Updated by Andreas Kienast about 2 months ago
- Status changed from New to Accepted
Updated by Gerrit Code Review about 2 months ago
- Status changed from Accepted to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86443
Updated by Rémi Payette about 2 months ago
I think the second case on line 176 :
case 'value':
should also use the \Collator class to do it's comparisons
Updated by Gerrit Code Review about 2 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86443
Updated by Gerrit Code Review about 1 month ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86552
Updated by Anonymous about 1 month ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 4a0bcf6a3f4e0d5db10a0e519740e760c9c17f5e.
Updated by S P about 1 month ago
- Is duplicate of Bug #95575: Built-in sortItems by "label" does not respect UTF-8 added