Bug #84885
closedImages in backend list module aren't shown, if they in a palette
100%
Description
It might be a regression introduced with #26753.
I have a custom table with multiple images as FAL records. I use 'ctrl' => 'thumbnail' (https://docs.typo3.org/typo3cms/TCAReference/Ctrl/Index.html#thumbnail) to define a single as thumbnail.
This looks like:
<?php
return [
'ctrl' => [
// [...]
'thumbnail' => 'image_portrait',
// [...]
],
'interface' => [
// [...]
],
'types' => [
'1' => [
'showitem' => '
// [...]
--palette--;LLL:EXT:project/Resources/Private/Language/locallang_db.xlf:tx_project_domain_model_contestapplicationformdata.palette.images;images,
// [...]',
],
],
'palettes' => [
// [...]
'images' => ['showitem' => 'image_portrait, image_fashion'],
// [...]
],
'columns' => [
// [...]
'image_portrait' => [
'exclude' => 0,
'label' => 'LLL:EXT:project/Resources/Private/Language/locallang_db.xml:tx_project_domain_model_contestapplicationformdata.image_portrait',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image_portrait', [
// [...]
], 'jpg,jpeg,png,pdf'),
],
'image_fashion' => [
'exclude' => 0,
'label' => 'LLL:EXT:project/Resources/Private/Language/locallang_db.xml:tx_project_domain_model_contestapplicationformdata.image_fashion',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image_fashion', [
// [...]
], 'jpg,jpeg,png,pdf'),
],
// [...]
],
];
But this doesn't work, since DatabaseRecordList checks for the thumbnail column name in $GLOBALS['TCA'][$table]['types'][$type]['showitem']. But I wrapped my image column in a palette.
It would be necessary to determine the visibility state of the image on another way.
Something like looking through all palettes sound wrong to me.
My current workaround is, to move the wanted image outside the palette to showitems.
Any ideas from someone?
Best regards
Updated by David Gurk over 6 years ago
- Related to Bug #26753: Picture in backend list module will be displayed after change element type from picture to text added
Updated by Jörg Velletti over 6 years ago
I can confirm that behavior
- still works in 8.7.13 when the column is NOT in a palette
- does not work is inside of a palette
the only solution to expand the $visibleColumns with all included columns from used palettes in that type
means after 1456:
$visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem'];
replace all --palette-- configs with content of that palette ..
addig this 3 lines (maybe not the perfect code):
foreach ( $GLOBALS['TCA'][$table]['palettes'] as $key => $palette ) {
$visibleColumns = str_replace( $key , $palette['showitem'] , $visibleColumns ) ;
}
solved it
Updated by David Gurk over 6 years ago
Jörg Velletti wrote:
addig this 3 lines (maybe not the perfect code):
solved it
Nice! Would you mind to create a patch? Maybe we can get more feedback in the review phase.
Updated by David Gurk over 6 years ago
My suggested solution would slightly different:
// Flatten palettes into types showitem
$visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem'];
foreach ($GLOBALS['TCA'][$table]['palettes'] as $key => $palette) {
$paletteColumns = rtrim($palette['showitem'], ',');
$visibleColumns = preg_replace(
'/--palette--;[^;]*;(' . $key . ')/',
$paletteColumns,
$visibleColumns
);
}
if ($this->thumbs &&
trim($row[$thumbsCol]) &&
preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1
) {
// [...]
}
// [...]
Here the RegEx test with showitem from tt_content textmedia:
https://regex101.com/r/5uIBXb/1/
Updated by Gerrit Code Review over 6 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 https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by David Gurk over 6 years ago
Updated regular expression:
https://regex101.com/r/5uIBXb/5/
Updated by Gerrit Code Review over 6 years ago
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by Gerrit Code Review over 6 years ago
Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56821
Updated by David Gurk over 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ba07dd2a6609332c37e1cc8ef51fdffba837d838.
Updated by Gerrit Code Review over 6 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57744
Updated by David Gurk over 6 years ago
- Status changed from Under Review to Resolved
Applied in changeset 7b54811b18e5e7940762221ed818ae0f0f33cb88.