Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Build/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ parameters:
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Database\\\\Query\\\\QueryBuilder\\:\\:add\\(\\)\\.$#"
count: 1
path: ../Classes/ViewHelpers/GetDatabaseRecordViewHelper.php
-
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\IconProvider\\\\FontawesomeIconProvider not found\\.$#"
count: 2
path: ../Classes/Listener/BootCompleted.php
6 changes: 5 additions & 1 deletion Build/phpstan-baseline12.neon
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,8 @@ parameters:
-
message: "#^Parameter \\$record of method B13\\\\Backendpreviews\\\\Service\\\\DatabaseRowService\\:\\:getAdditionalDataForView\\(\\) has invalid type TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface\\.$#"
count: 1
path: ../Classes/Service/DatabaseRowService.php
path: ../Classes/Service/DatabaseRowService.php
-
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\IconProvider\\\\FontawesomeIconProvider not found\\.$#"
count: 2
path: ../Classes/Listener/BootCompleted.php
6 changes: 5 additions & 1 deletion Build/phpstan-baseline13.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ parameters:
-
message: "#^Parameter \\#2 \\$row of method TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\BackendUserAuthentication\\:\\:recordEditAccessInternals\\(\\) expects array, TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface given\\.$#"
count: 1
path: ../Classes/Service/DatabaseRowService.php
path: ../Classes/Service/DatabaseRowService.php
-
message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\IconProvider\\\\FontawesomeIconProvider not found\\.$#"
count: 2
path: ../Classes/Listener/BootCompleted.php
45 changes: 45 additions & 0 deletions Classes/Listener/BootCompleted.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

declare(strict_types=1);

namespace B13\Backendpreviews\Listener;

/*
* This file is part of TYPO3 CMS-extension backendpreviews by b13.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*/

use TYPO3\CMS\Core\Core\Event\BootCompletedEvent;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Package\PackageManager;

class BootCompleted
{
public function __construct(protected IconRegistry $iconRegistry, protected PackageManager $packageManager)
{
}

public function __invoke(BootCompletedEvent $event): void
{
if (!$this->packageManager->isPackageActive('fontawesome_provider')) {
return;
}
$this->iconRegistry->registerIcon(
'exclamation-triangle',
\TYPO3\CMS\Core\Imaging\IconProvider\FontawesomeIconProvider::class,
[
'name' => 'exclamation-triangle',
]
);
$this->iconRegistry->registerIcon(
'exclamation-circle',
\TYPO3\CMS\Core\Imaging\IconProvider\FontawesomeIconProvider::class,
[
'name' => 'exclamation-circle',
]
);
}
}
4 changes: 4 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ services:
- name: event.listener
event: TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent
identifier: 'b13-backendpreview-page-content-preview-rendering'
B13\Backendpreviews\Listener\BootCompleted:
tags:
- name: event.listener
identifier: 'b13-backendpreview-boot-completed'
5 changes: 1 addition & 4 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
// if TYPO3 > 11 "$GLOBALS['TCA']['tt_content']['ctrl']['previewRenderer']" is always used for Backend-Preview-Rendering
// extending the database row is handled by B13\Backendpreviews\Listener\PageContentPreviewRendering

if (
(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class))->getMajorVersion() < 12 ||
(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Package\PackageManager::class)->isPackageActive('fontawesome_provider'))
) {
if ((new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() < 12) {
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon(
'exclamation-triangle',
Expand Down