Skip to content

Commit

Permalink
[TASK] Moved icon configurations to Configuration/Icons.php and also …
Browse files Browse the repository at this point in the history
…moved pageTs configuration to Configuration folder
  • Loading branch information
hojalatheef committed Oct 31, 2024
1 parent 91cacab commit 327f1a7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
17 changes: 16 additions & 1 deletion Configuration/Icons.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
<?php

use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider;
use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;

return [
'ext-weather2' => [
'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
'provider' => SvgIconProvider::class,
'source' => 'EXT:weather2/Resources/Public/Icons/Extension.svg',
],
'ext-weather2-table-currentweather' => [
'provider' => BitmapIconProvider::class,
'source' => 'EXT:weather2/Resources/Public/Icons/tx_weather2_domain_model_currentweather.gif',
],
'ext-weather2-table-dwdwarncell' => [
'provider' => BitmapIconProvider::class,
'source' => 'EXT:weather2/Resources/Public/Icons/tx_weather2_domain_model_dwdwarncell.gif',
],
'ext-weather2-table-weatheralert' => [
'provider' => BitmapIconProvider::class,
'source' => 'EXT:weather2/Resources/Public/Icons/tx_weather2_domain_model_weatheralert.gif',
],
];
1 change: 1 addition & 0 deletions Configuration/page.tsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'EXT:weather2/Configuration/TSconfig/ContentElementWizard.tsconfig'
49 changes: 19 additions & 30 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,50 @@
die('Access denied.');
}

use JWeiland\Weather2\Controller\CurrentWeatherController;
use JWeiland\Weather2\Controller\WeatherAlertController;
use JWeiland\Weather2\Task\DeutscherWetterdienstTask;
use JWeiland\Weather2\Task\DeutscherWetterdienstTaskAdditionalFieldProvider;
use JWeiland\Weather2\Task\DeutscherWetterdienstWarnCellTask;
use JWeiland\Weather2\Task\OpenWeatherMapTask;
use JWeiland\Weather2\Task\OpenWeatherMapTaskAdditionalFieldProvider;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

call_user_func(static function () {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][JWeiland\Weather2\Task\OpenWeatherMapTask::class] = [
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][OpenWeatherMapTask::class] = [
'extension' => 'weather2',
'title' => 'Call openweathermap.org api',
'description' => 'Calls the api of openweathermap.org and saves response into database',
'additionalFields' => JWeiland\Weather2\Task\OpenWeatherMapTaskAdditionalFieldProvider::class,
'additionalFields' => OpenWeatherMapTaskAdditionalFieldProvider::class,
];

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][JWeiland\Weather2\Task\DeutscherWetterdienstTask::class] = [
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][DeutscherWetterdienstTask::class] = [
'extension' => 'weather2',
'title' => 'Get weather alerts from Deutscher Wetterdienst',
'description' => 'Calls the Deutscher Wetterdienst api and saves response in weather2 format into database',
'additionalFields' => JWeiland\Weather2\Task\DeutscherWetterdienstTaskAdditionalFieldProvider::class,
'additionalFields' => DeutscherWetterdienstTaskAdditionalFieldProvider::class,
];

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][JWeiland\Weather2\Task\DeutscherWetterdienstWarnCellTask::class] = [
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][DeutscherWetterdienstWarnCellTask::class] = [
'extension' => 'weather2',
'title' => 'Get warn cell records from Deutscher Wetterdienst',
'description' => 'Calls the Deutscher Wetterdienst api and saves warn cells into database. Required before using DeutscherWetterdienstTask!',
];

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Weather2',
'Currentweather',
[
\JWeiland\Weather2\Controller\CurrentWeatherController::class => 'show',
CurrentWeatherController::class => 'show',
],
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
ExtensionUtility::configurePlugin(
'Weather2',
'Weatheralert',
[
\JWeiland\Weather2\Controller\WeatherAlertController::class => 'show',
WeatherAlertController::class => 'show',
],
);

// Add weather2 plugins to new element wizard
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:weather2/Configuration/TSconfig/ContentElementWizard.tsconfig">',
);

// Register Bitmap Icon Identifier
$bmpIcons = [
'ext-weather2-table-currentweather' => 'tx_weather2_domain_model_currentweather.gif',
'ext-weather2-table-dwdwarncell' => 'tx_weather2_domain_model_dwdwarncell.gif',
'ext-weather2-table-weatheralert' => 'tx_weather2_domain_model_weatheralert.gif',
];

$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
foreach ($bmpIcons as $identifier => $fileName) {
$iconRegistry->registerIcon(
$identifier,
\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
['source' => 'EXT:weather2/Resources/Public/Icons/' . $fileName],
);
}
});

0 comments on commit 327f1a7

Please sign in to comment.