diff --git a/Build/phpstan-baseline.neon b/Build/phpstan-baseline.neon index 2faaf69..b4fa326 100644 --- a/Build/phpstan-baseline.neon +++ b/Build/phpstan-baseline.neon @@ -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 diff --git a/Build/phpstan-baseline12.neon b/Build/phpstan-baseline12.neon index 9266255..aa87cd2 100644 --- a/Build/phpstan-baseline12.neon +++ b/Build/phpstan-baseline12.neon @@ -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 \ No newline at end of file + path: ../Classes/Service/DatabaseRowService.php + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\IconProvider\\\\FontawesomeIconProvider not found\\.$#" + count: 2 + path: ../Classes/Listener/BootCompleted.php diff --git a/Build/phpstan-baseline13.neon b/Build/phpstan-baseline13.neon index 41978b7..7eb3c96 100644 --- a/Build/phpstan-baseline13.neon +++ b/Build/phpstan-baseline13.neon @@ -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 \ No newline at end of file + path: ../Classes/Service/DatabaseRowService.php + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\IconProvider\\\\FontawesomeIconProvider not found\\.$#" + count: 2 + path: ../Classes/Listener/BootCompleted.php diff --git a/Classes/Listener/BootCompleted.php b/Classes/Listener/BootCompleted.php new file mode 100644 index 0000000..4d797c9 --- /dev/null +++ b/Classes/Listener/BootCompleted.php @@ -0,0 +1,45 @@ +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', + ] + ); + } +} diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 56552b1..6d456a7 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -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' diff --git a/ext_localconf.php b/ext_localconf.php index 8b2d820..e25159a 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -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',