Skip to content

Commit

Permalink
[BUGFIX] Provide legacy-compatible alternate markup for content icon …
Browse files Browse the repository at this point in the history
…hook
  • Loading branch information
NamelessCoder committed May 1, 2022
1 parent 5800d7f commit 9d2a75c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Classes/Integration/HookSubscribers/ContentIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;
Expand All @@ -35,7 +36,11 @@ class ContentIcon
'gridToggle' => '<div class="fluidcontent-toggler col-auto">
<div class="btn-group btn-group-sm" role="group">
<a class="btn btn-default %s" title="%s" data-toggler-uid="%s">%s</a>
</div></div>'
</div></div>',
'legacyGridToggle' => '</div><div class="fluidcontent-toggler">
<div class="btn-group btn-group-sm" role="group">
<a class="btn btn-default %s" title="%s" data-toggler-uid="%s">%s</a>
</div></div><div>',
];

/**
Expand Down Expand Up @@ -145,7 +150,9 @@ protected function drawGridToggle(array $row)
$label = $GLOBALS['LANG']->sL('LLL:EXT:flux/Resources/Private/Language/locallang.xlf:toggle_content');
$icon = $collapseIcon . $expandIcon;

$rendered = sprintf($this->templates['gridToggle'], $this->isRowCollapsed($row)? 'toggler-expand' : 'toggler-collapse', $label, $row['uid'], $icon);
$template = version_compare(VersionNumberUtility::getCurrentTypo3Version(), '11', '<') ? $this->templates['legacyGridToggle'] : $this->templates['gridToggle'];

$rendered = sprintf($template, $this->isRowCollapsed($row)? 'toggler-expand' : 'toggler-collapse', $label, $row['uid'], $icon);

return HookHandler::trigger(
HookHandler::PREVIEW_GRID_TOGGLE_RENDERED,
Expand Down

0 comments on commit 9d2a75c

Please sign in to comment.