Project

General

Profile

Actions

Bug #105316

open

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

Added by Stephan Lindner s.lindner about 3 hours ago.

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

0%

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.

No data to display

Actions

Also available in: Atom PDF