diff --git a/Classes/Backend/FlexformHelper.php b/Classes/Backend/FlexformHelper.php index f0c1a5f..bf6d48e 100644 --- a/Classes/Backend/FlexformHelper.php +++ b/Classes/Backend/FlexformHelper.php @@ -11,7 +11,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; -use TYPO3\CMS\Extbase\Object\ObjectManager; /** * Helper functions for Flexform diff --git a/Classes/Backend/TceForms.php b/Classes/Backend/TceForms.php deleted file mode 100644 index be1579d..0000000 --- a/Classes/Backend/TceForms.php +++ /dev/null @@ -1,95 +0,0 @@ -getTypoScriptSetup(); - $configuration = $this->getPluginConfiguration($setup, 'rssdisplay'); - - $output = ''; - if (is_array($configuration['settings']['templates'])) { - - $selectedItem = ''; - if (!empty($row['pi_flexform'])) { - $values = $row['pi_flexform']; - if (!empty($values['data']['sDEF']['lDEF']['settings.template'])) { - $selectedItem = $values['data']['sDEF']['lDEF']['settings.template']['vDEF']; - } - } - - $options = array(); - foreach ($configuration['settings']['templates'] as $template) { - $options[] = sprintf('', - $template['path'], - $selectedItem == $template['path'] ? 'selected="selected"' : '', - $template['label'] - ); - } - - $output = sprintf('', - $row['uid'], - implode("\n", $options) - ); - } - return $output; - } - - /** - * Render a template. - * - * @return array - */ - public function render() { - $result = $this->initializeResultArray(); - $result["html"] = $this->renderTemplateMenu($this->data["databaseRow"]); - return $result; - } - - /** - * Returns the TypoScript configuration found an extension name - * - * @param array $setup - * @param string $extensionName - * @return array - * @throws \InvalidArgumentException - */ - protected function getPluginConfiguration(array $setup, $extensionName) - { - $pluginConfiguration = array(); - if (is_array($setup['plugin.']['tx_' . strtolower($extensionName) . '.'])) { - /** @var \TYPO3\CMS\Core\TypoScript\TypoScriptService $typoScriptService */ - $typoScriptService = GeneralUtility::makeInstance('TYPO3\CMS\Core\TypoScript\TypoScriptService'); - $pluginConfiguration = $typoScriptService->convertTypoScriptArrayToPlainArray($setup['plugin.']['tx_' . strtolower($extensionName) . '.']); - } - return $pluginConfiguration; - } -} diff --git a/Classes/Backend/Wizard.php b/Classes/Backend/Wizard.php deleted file mode 100644 index 24ef98e..0000000 --- a/Classes/Backend/Wizard.php +++ /dev/null @@ -1,59 +0,0 @@ - $key) { - if(strpos($key, 'plugin') === 0) { - $found = true; - } elseif (isset($found)) { - array_splice($wizardItems, $index, 0, [ - 'plugins_tx_rssdisplay_pi1' => [ - 'iconIdentifier' => 'plugins_tx_rssdisplay_pi1_wizard', // <- see ext_tables.php - 'iconIdentifier' => 'ext-news-wizard-icon', // <- see ext_tables.php - 'title' => $this->getLanguageService()->sL('LLL:EXT:rss_display/Resources/Private/Language/locallang.xlf:wizard.title'), - 'description' => $this->getLanguageService()->sL('LLL:EXT:rss_display/Resources/Private/Language/locallang.xlf:wizard.description'), - 'saveAndClose' => false, - 'tt_content_defValues' => [ - 'CType' => "list", - 'list_type' => "rssdisplay_pi1" - ], - 'params' => '&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=rssdisplay_pi1' - ] - ]); - break; - }; - } - } - - /** - * @return \TYPO3\CMS\Core\Localization\LanguageService - */ - protected function getLanguageService(): \TYPO3\CMS\Core\Localization\LanguageService - { - return $GLOBALS['LANG']; - } - -} diff --git a/Classes/Controller/FeedController.php b/Classes/Controller/FeedController.php index b6410b9..89f4dae 100755 --- a/Classes/Controller/FeedController.php +++ b/Classes/Controller/FeedController.php @@ -16,6 +16,7 @@ use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; +use Psr\Http\Message\ResponseInterface; /** * RSS display that will fetch the content of a RSS Feed and display it onto the Frontend. @@ -31,7 +32,7 @@ class FeedController extends ActionController * Initialize object * @throws \RuntimeException */ - public function initializeAction() + public function initializeAction(): void { if (empty($this->settings['template'])) { $this->settings['template'] = 'EXT:rss_display/Resources/Private/Templates/Feed/Show.html'; @@ -45,10 +46,9 @@ public function initializeAction() } /** - * @return string * @throws \Exception */ - public function showAction() + public function showAction(): ResponseInterface { // @todo !! better add check if the Feed URL is alive. If not log it and send an email to the webmaster. @@ -68,7 +68,7 @@ public function showAction() $this->view->assign('title', $feed->get_title()); $this->view->assign('items', $feed->get_items(0, (int)$this->settings['numberOfItems'])); $this->view->assign('settings', $this->settings); - $cObj = $this->configurationManager->getContentObject(); + $cObj = $this->request->getAttribute('currentContentObject'); $this->view->assign('data', $cObj->data); $result = $this->view->render(); @@ -79,7 +79,7 @@ public function showAction() } } - return $result; + return $this->htmlResponse($result); } /** @@ -106,7 +106,7 @@ protected function canFetchResultFromCache() $result = FALSE; if ($this->getPluginType() === self::PLUGIN_TYPE_USER_INT && $this->getCacheInstance()->has($this->getCacheIdentifier()) - && !GeneralUtility::_GET('no_cache') + && !($this->request->getQueryParams()['no_cache'] ?? null) ) { $result = TRUE; } diff --git a/Configuration/FlexForm/feed.xml b/Configuration/FlexForm/feed.xml index 2bc7d89..bf36c11 100644 --- a/Configuration/FlexForm/feed.xml +++ b/Configuration/FlexForm/feed.xml @@ -11,37 +11,30 @@ array - - - - input - 50 - 400 - http://www.w3.org/blog/news/feed/atom - - + + + input + 50 + 400 + http://www.w3.org/blog/news/feed/atom + - - - - input - 30 - int - 10 - - + + + input + 30 + int + 10 + - - - - select - Fab\RssDisplay\Backend\FlexformHelper->populateTemplatesList - selectSingle - - - + + + select + Fab\RssDisplay\Backend\FlexformHelper->populateTemplatesList + selectSingle + diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml new file mode 100644 index 0000000..f32e8dc --- /dev/null +++ b/Configuration/Services.yaml @@ -0,0 +1,12 @@ +services: + # general settings + _defaults: + autowire: true + autoconfigure: true + public: false + + Fab\RssDisplay\: + resource: '../Classes/*' + + Fab\RssDisplay\Controller\FeedController: + public: true \ No newline at end of file diff --git a/Configuration/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php similarity index 94% rename from Configuration/Configuration/TCA/Overrides/tt_content.php rename to Configuration/TCA/Overrides/tt_content.php index 95942b8..6c8c381 100644 --- a/Configuration/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -1,12 +1,13 @@ 'Ecodev', 'constraints' => [ 'depends' => [ - 'typo3' => '10.4.0-11.5.99', + 'typo3' => '12.4.0-13.4.99', ], ], ]; diff --git a/ext_localconf.php b/ext_localconf.php index 24d6226..990479d 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,6 +1,12 @@ getMajorVersion() >= 11) { - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'rss_display', - 'Pi1', - [\Fab\RssDisplay\Controller\FeedController::class => 'show'], - $pluginType === 'USER_INT' ? [\Fab\RssDisplay\Controller\FeedController::class => 'show'] : [], - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_PLUGIN - ); - -} else { - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'Fab.rss_display', - 'Pi1', - ['Feed' => 'show'], - $pluginType === 'USER_INT' ? ['Feed' => 'show'] : [] - ); -} +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'rss_display', + 'Pi1', + [FeedController::class => 'show'], + $pluginType === 'USER_INT' ? [FeedController::class => 'show'] : [], + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_PLUGIN +); // cache configuration, see // https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/CachingFramework/Configuration/Index.html#cache-configurations diff --git a/ext_tables.php b/ext_tables.php index 9615237..b3b0f1c 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,5 +1,5 @@