Skip to content
Snippets Groups Projects
Commit 87c6aa85 authored by Fabian Galinski's avatar Fabian Galinski :pouting_cat:
Browse files

[FEATURE] Some improvements and new functions for the author news

parent e2a72955
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -182,6 +182,10 @@ class Author extends AbstractEntity {
}
}
return $this->email;
if ($this->image instanceof LazyLoadingProxy) {
$this->image->_loadRealInstance();
}
return $this->image;
}
}
<?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);
}
}
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment