diff --git a/Classes/Controller/NewsByAuthorController.php b/Classes/Controller/NewsByAuthorController.php index 9d72e1e250c3229b12194c2b39ac40da5a4b41ca..24e0f563502c0ecd2868c52deadcc06adaace3e9 100644 --- a/Classes/Controller/NewsByAuthorController.php +++ b/Classes/Controller/NewsByAuthorController.php @@ -50,7 +50,6 @@ class NewsByAuthorController extends AbstractController { return; } - $news = []; $authors = []; $authorRepository = $this->objectManager->get(AuthorRepository::class); foreach ($newsAuthorsIds as $newsAuthorsId) { @@ -72,11 +71,15 @@ class NewsByAuthorController extends AbstractController { return; } - $categories = []; + $categories = $newsMetaData = []; $categoryRepository = $this->objectManager->get(CategoryRepository::class); - $newsMetaData = []; + $excludedNewsIds = GeneralUtility::intExplode(',', $this->settings['excludedNews']); foreach ($news as $newsEntry) { /** @var News $newsEntry */ + if (in_array($newsEntry->getUid(), $excludedNewsIds, TRUE)) { + continue; + } + $categoryId = $newsEntry->getPid(); if (!isset($categories[$categoryId])) { $category = $categoryRepository->findByUid($categoryId); diff --git a/Classes/Domain/Model/Author.php b/Classes/Domain/Model/Author.php index 75e64ae3e403feed1db42abc09491695c0bdae62..20389424ec8bdcdb767ab716960045d749dd45bd 100644 --- a/Classes/Domain/Model/Author.php +++ b/Classes/Domain/Model/Author.php @@ -182,6 +182,10 @@ class Author extends AbstractEntity { } } - return $this->email; + if ($this->image instanceof LazyLoadingProxy) { + $this->image->_loadRealInstance(); + } + + return $this->image; } } diff --git a/Classes/ViewHelpers/RenderAuthorNewsViewHelper.php b/Classes/ViewHelpers/RenderAuthorNewsViewHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..d5980cc749bb0149745631557c49b4c7b4e83016 --- /dev/null +++ b/Classes/ViewHelpers/RenderAuthorNewsViewHelper.php @@ -0,0 +1,97 @@ +<?php + +namespace SGalinski\SgNews\ViewHelpers; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (http://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the AY project. The AY 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\Extbase\Core\Bootstrap; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; + +/** + * Example: + * {namespace sgnews=SGalinski\SgNews\ViewHelpers} + * <sgnews:renderAuthorNews newsAuthors="123,321" excludedNews="123,423" /> + */ +class RenderAuthorNewsViewHelper extends AbstractViewHelper { + /** + * Extbase Bootstrap + * + * @var Bootstrap + */ + protected $bootstrap; + + /** + * @param Bootstrap $bootstrap + * @return void + */ + public function injectBootstrap(Bootstrap $bootstrap) { + $this->bootstrap = $bootstrap; + } + + /** + * CommentThreadViewHelper constructor. + */ + public function __construct() { + $this->escapeOutput = FALSE; + $this->escapeChildren = FALSE; + } + + /** + * Initialize arguments. + * + * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception + * @return void + * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception + */ + public function initializeArguments() { + $this->registerArgument('newsAuthors', 'string', 'A list with author uids', TRUE); + $this->registerArgument('excludedNews', 'string', 'A list with excluded news uids'); + } + + /** + * Renders the Comment plugin. The view helper arguments configures the behavior. + * + * @return mixed + */ + public function render() { + $configuration = [ + 'extensionName' => 'SgNews', + 'vendorName' => 'SGalinski', + 'pluginName' => 'NewsByAuthor', + 'controllerName' => 'NewsByAuthor', + 'action' => 'list' + ]; + + if ($this->arguments['newsAuthors']) { + $configuration['settings']['newsAuthors'] = $this->arguments['newsAuthors']; + } + + if ($this->arguments['excludedNews']) { + $configuration['settings']['excludedNews'] = $this->arguments['excludedNews']; + } + + return $this->bootstrap->run('', $configuration); + } +} diff --git a/Configuration/FlexForms/NewsByAuthor.xml b/Configuration/FlexForms/NewsByAuthor.xml index 18e816fd1652c182c738d94dbb42ec643a10cd09..14a87ebdae9740d11373b9c7d508ab32c4f98b69 100644 --- a/Configuration/FlexForms/NewsByAuthor.xml +++ b/Configuration/FlexForms/NewsByAuthor.xml @@ -28,6 +28,20 @@ </config> </TCEforms> </settings.newsAuthors> + + <settings.excludedNews> + <TCEforms> + <label>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.excludedNews</label> + <config> + <type>select</type> + <renderType>selectMultipleSideBySide</renderType> + <size>5</size> + <maxitems>99</maxitems> + <foreign_table>pages</foreign_table> + <foreign_table_where>AND pages.sys_language_uid IN (-1, 0) AND pages.doktype = 116 ORDER BY pages.title</foreign_table_where> + </config> + </TCEforms> + </settings.excludedNews> </el> </ROOT> </main> diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index d2d570c0edeb9fc5bc88b86da7cf63c4db1f35e7..afd03d0df98cd7a224e61e3351200b2f645ab449 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -101,6 +101,10 @@ <source><![CDATA[Only show news published before]]></source> <target><![CDATA[Zeige nur News veröffentlicht vor]]></target> </trans-unit> + <trans-unit id="plugin.flexForm.excludedNews" approved="yes"> + <source><![CDATA[News which are excluded from the list]]></source> + <target><![CDATA[News, welche nicht in der Liste dargestellt werden]]></target> + </trans-unit> <trans-unit id="plugin.flexForm.newsAuthor" approved="yes"> <source><![CDATA[News Author]]></source> <target><![CDATA[News Autor]]></target> diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index deb302385eaa8df067be28058f39a3b1d7ac2d4a..71c34dcd8da4476c4ff6b322cf3b6b1c7eb1f9cd 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -78,6 +78,9 @@ <trans-unit id="plugin.flexForm.endtime"> <source><![CDATA[Only show news published before]]></source> </trans-unit> + <trans-unit id="plugin.flexForm.excludedNews"> + <source><![CDATA[News which are excluded from the list]]></source> + </trans-unit> <trans-unit id="plugin.flexForm.newsAuthor"> <source><![CDATA[News Author]]></source> </trans-unit>