Project

General

Profile

Actions

Bug #105316

closed

Unhide button in list module for record doesn't show custom overlay-icon

Added by Stephan Lindner s.lindner 4 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2024-10-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I use the Hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Imaging\IconFactory::class]['overrideIconOverlay'][] to set an overlay icon in the list module depending on the value of a field in my record.

<?php

namespace MyNamespace\MyExtension\Hook;

class IconFactoryHook
{
    /**
     * @param string $table
     * @param array $row
     * @param array $status
     * @param string $iconName
     * @return string the new (or given) $iconName
     */
    function postOverlayPriorityLookup($table, array $row, array $status, $iconName) {

        if ($table == "my_table") {
            $record = $this->getRecordByUid('my_table', $row['uid']);
            if ($record['link_type']==1) {
                $statusValue = false;
                foreach ($status as $item) {
                    if ($item === true) {
                        $statusValue = true;
                        break;
                    }
                }
                if (!$statusValue) {
                    $iconName = 'overlay-shortcut';
                }
            }
        }
        return $iconName;
    }

Everything works as expected, when I click on a folder in the page tree. However, if I un-hide a hidden record, the overlay icon for hidden is removed, but my custom icon is not shown. Instead there is no overlay-icon shown. And if I hide a record with my custom overlay icon and unhide it again, the record is un-hidden again, but the hide overlay icon stays at it is.
I would expect, that the hook for an overlay-icon is also called when I un-hide a record so that my overlay-icon is shown as it is shown when I click on the folder in the page tree.

Actions #1

Updated by Gerrit Code Review 4 months ago

  • Status changed from New 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/+/86643

Actions #2

Updated by Andreas Kienast 4 months ago

Dummy event listener implementation to test the patch in v13:

<?php

declare(strict_types=1);

namespace Vendor\Package\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Imaging\Event\ModifyRecordOverlayIconIdentifierEvent;

final class ModifyRecordOverlayIconIdentifierEventListener
{
    #[AsEventListener(identifier: 'icon-modifier', event: ModifyRecordOverlayIconIdentifierEvent::class)]
    public function __invoke(ModifyRecordOverlayIconIdentifierEvent $event) {
        if ($event->getTable() === 'tt_content') {
            if ((int)$event->getRow()['hidden'] === 1) {
                $event->setOverlayIconIdentifier('overlay-missing');
            }
        }
    }
}
Actions #3

Updated by Gerrit Code Review 4 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/+/86643

Actions #4

Updated by Gerrit Code Review 4 months ago

Patch set 3 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/+/86643

Actions #5

Updated by Gerrit Code Review 3 months ago

Patch set 4 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/+/86643

Actions #6

Updated by Gerrit Code Review 3 months ago

Patch set 1 for branch 13.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/+/86889

Actions #7

Updated by Gerrit Code Review 3 months 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/+/86890

Actions #8

Updated by Anonymous 3 months ago

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

Also available in: Atom PDF