#105316Unhide button in list module for record doesn't show custom overlay-icon
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.
Reviews 3
History 39
-
Gerrit Code Review pushed patch set 1 for main to change 86643 status
NewUnder Review <span data-processor="relativetime" data-value="2024-10-17T13:59:34+00:00" > 10/17/24, 13:59 </span> -
Andreas Kienast commented <span data-processor="relativetime" data-value="2024-10-17T14:04:59+00:00" > 10/17/24, 14:04 </span>
-
Gerrit Code Review pushed patch set 2 for main to change 86643 <span data-processor="relativetime" data-value="2024-10-18T06:24:30+00:00" > 10/18/24, 06:24 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 86643 <span data-processor="relativetime" data-value="2024-10-18T13:53:58+00:00" > 10/18/24, 13:53 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 86643 <span data-processor="relativetime" data-value="2024-10-31T11:28:42+00:00" > 10/31/24, 11:28 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 86889 <span data-processor="relativetime" data-value="2024-11-06T06:49:12+00:00" > 11/06/24, 06:49 </span>
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 86890 <span data-processor="relativetime" data-value="2024-11-06T06:49:53+00:00" > 11/06/24, 06:49 </span>
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2024-11-06T07:00:10+00:00" > 11/06/24, 07:00 </span>Applied in changeset commit:c0710cea6d900997edf4ac0fdaa61eabc5de69b7.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:32:51+00:00" > 12/02/25, 14:32 </span>
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'); } } } }