Project

General

Profile

Actions

Bug #84885

closed

Images in backend list module aren't shown, if they in a palette

Added by David Gurk almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2018-04-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php#L1460

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


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #26753: Picture in backend list module will be displayed after change element type from picture to textClosed2011-05-11

Actions
Actions #1

Updated by David Gurk almost 6 years ago

  • Related to Bug #26753: Picture in backend list module will be displayed after change element type from picture to text added
Actions #2

Updated by Jörg Velletti almost 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

Actions #3

Updated by David Gurk almost 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.

Actions #4

Updated by David Gurk almost 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/

Actions #5

Updated by Gerrit Code Review almost 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

Actions #6

Updated by Gerrit Code Review almost 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

Actions #7

Updated by Gerrit Code Review almost 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

Actions #8

Updated by Gerrit Code Review almost 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

Actions #9

Updated by Gerrit Code Review almost 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

Actions #10

Updated by Gerrit Code Review almost 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

Actions #11

Updated by Gerrit Code Review almost 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

Actions #12

Updated by Gerrit Code Review almost 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

Actions #13

Updated by Gerrit Code Review almost 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

Actions #14

Updated by David Gurk almost 6 years ago

Updated regular expression:
https://regex101.com/r/5uIBXb/5/

Actions #15

Updated by Gerrit Code Review almost 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

Actions #16

Updated by Gerrit Code Review almost 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

Actions #17

Updated by Gerrit Code Review almost 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

Actions #18

Updated by Gerrit Code Review almost 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

Actions #19

Updated by Gerrit Code Review almost 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

Actions #20

Updated by Gerrit Code Review over 5 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

Actions #21

Updated by Gerrit Code Review over 5 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

Actions #22

Updated by Gerrit Code Review over 5 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

Actions #23

Updated by Gerrit Code Review over 5 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

Actions #24

Updated by David Gurk over 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #25

Updated by Gerrit Code Review over 5 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

Actions #26

Updated by David Gurk over 5 years ago

  • Status changed from Under Review to Resolved
Actions #27

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF