Skip to content
Snippets Groups Projects
Verified Commit 687abd41 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Abbort rendering Related news if news argument is not of type News

parent 0637d9d8
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
namespace SGalinski\SgNews\ViewHelpers;
use SGalinski\SgNews\Domain\Model\News;
use SGalinski\SgNews\Domain\Repository\CategoryRepository;
use SGalinski\SgNews\Domain\Repository\NewsRepository;
use SGalinski\SgNews\Domain\Service\NewsService;
......@@ -27,7 +28,7 @@ class RelatedViewHelper extends AbstractViewHelper {
public function initializeArguments() {
$this->registerArgument(
'news',
'SGalinski\SgNews\Domain\Model\News',
News::class,
'The news record from which to find related news',
TRUE
);
......@@ -77,6 +78,10 @@ class RelatedViewHelper extends AbstractViewHelper {
$categoryRepository = GeneralUtility::makeInstance(CategoryRepository::class);
$templateVariableContainer = $renderingContext->getVariableProvider();
$news = $arguments['news'];
if (!($news instanceof News)) {
return '';
}
$newsRepository = GeneralUtility::makeInstance(NewsRepository::class);
if ($arguments['relatedNews']) {
$related = $arguments['relatedNews'];
......
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