From 9e880e80084fc91e7a60f6681a74048b5675464e Mon Sep 17 00:00:00 2001 From: Stefan Galinski <stefan@sgalinski.de> Date: Fri, 2 Sep 2016 21:31:18 +0200 Subject: [PATCH] [FEATURE] Improve integration of the news feed to allow settings --- Classes/Controller/NewsFeedController.php | 51 ++++++++++--------- Configuration/TypoScript/Frontend/setup.txt | 18 ++++++- .../Private/Language/de.locallang_backend.xlf | 4 -- .../Private/Language/locallang_backend.xlf | 3 -- ext_tables.php | 6 --- 5 files changed, 44 insertions(+), 38 deletions(-) diff --git a/Classes/Controller/NewsFeedController.php b/Classes/Controller/NewsFeedController.php index 1c130c4..8808e69 100644 --- a/Classes/Controller/NewsFeedController.php +++ b/Classes/Controller/NewsFeedController.php @@ -2,29 +2,31 @@ namespace SGalinski\SgNews\Controller; - /*************************************************************** - * Copyright notice - * - * (c) sgalinski Internet Services (https://www.sgalinski.de) - * - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Core\Utility\GeneralUtility; /** * Controller that handles the news feed rendering @@ -42,7 +44,8 @@ class NewsFeedController extends AbstractController { * @return void */ public function indexAction() { - $news = $this->newsRepository->findLastUpdatedOrHighlightedNewsByCategories(10, FALSE); + $categories = GeneralUtility::intExplode(',', $this->settings['showCategories'], TRUE); + $news = $this->newsRepository->findLastUpdatedOrHighlightedNewsByCategories(10, FALSE, $categories); $this->view->assign('news', $news); } } diff --git a/Configuration/TypoScript/Frontend/setup.txt b/Configuration/TypoScript/Frontend/setup.txt index e4ccb4f..fcf18fa 100644 --- a/Configuration/TypoScript/Frontend/setup.txt +++ b/Configuration/TypoScript/Frontend/setup.txt @@ -9,7 +9,23 @@ newsFeed = PAGE newsFeed { typeNum = 78906523 - 10 < tt_content.list.20.sgnews_newsfeed + 10 = USER + 10 { + userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run + extensionName = SgNews + pluginName = NewsFeed + vendorName = SGalinski + controller = NewsFeed + action = index + view < plugin.tx_sgnews.view + persistence < plugin.tx_sgnews.persistence + features < plugin.tx_sgnews.features + legacy < plugin.tx_sgnews.legacy + settings { + # if not provided all categories are shown + showCategories = + } + } config { disableAllHeaderCode = 1 diff --git a/Resources/Private/Language/de.locallang_backend.xlf b/Resources/Private/Language/de.locallang_backend.xlf index 390e281..49715fd 100644 --- a/Resources/Private/Language/de.locallang_backend.xlf +++ b/Resources/Private/Language/de.locallang_backend.xlf @@ -33,10 +33,6 @@ <source>News Overview</source> <target>News-Ãœbersicht</target> </trans-unit> - <trans-unit id="titlePageBrowserPlugin" approved="yes"> - <source>Page Browser Plugin</source> - <target>Seitenbrowser-Plugin</target> - </trans-unit> <trans-unit id="titleSingleViewPlugin" approved="yes"> <source>News Single View</source> <target>News-Einzelansicht</target> diff --git a/Resources/Private/Language/locallang_backend.xlf b/Resources/Private/Language/locallang_backend.xlf index 12770e7..885fca1 100644 --- a/Resources/Private/Language/locallang_backend.xlf +++ b/Resources/Private/Language/locallang_backend.xlf @@ -27,9 +27,6 @@ <trans-unit id="titleOverviewPlugin"> <source>News Overview</source> </trans-unit> - <trans-unit id="titlePageBrowserPlugin"> - <source>Page Browser Plugin</source> - </trans-unit> <trans-unit id="titleSingleViewPlugin"> <source>News Single View</source> </trans-unit> diff --git a/ext_tables.php b/ext_tables.php index 564a6a3..1bd3d27 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -28,17 +28,11 @@ TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:titleListByCategoryPlugin' ); -TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'sg_news', 'PageBrowser', - 'LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:titlePageBrowserPlugin' -); - // Removal of the unused plugin setting fields $TCA['tt_content']['types']['list']['subtypes_excludelist']['sgnews_overview'] = 'select_key,pages,recursive'; $TCA['tt_content']['types']['list']['subtypes_excludelist']['sgnews_listbycategory'] = 'select_key,pages,recursive'; $TCA['tt_content']['types']['list']['subtypes_excludelist']['sgnews_latest'] = 'select_key,pages,recursive'; $TCA['tt_content']['types']['list']['subtypes_excludelist']['sgnews_singleview'] = 'select_key,pages,recursive'; -$TCA['tt_content']['types']['list']['subtypes_excludelist']['sgnews_pagebrowser'] = 'select_key,pages,recursive'; // Flex form assignment $pluginSignature = str_replace('_', '', 'sg_news') . '_overview'; -- GitLab