* * * * None * */ class ExcludeDisplayedNewsViewHelper extends AbstractViewHelper implements ViewHelperInterface { use CompileWithRenderStatic; /** * Initialize arguments */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('newsItem', News::class, 'news item', true); } /** * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return void */ public static function renderStatic( array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext ) { $newsItem = $arguments['newsItem']; $uid = $newsItem->getUid(); if (empty($GLOBALS['EXT']['news']['alreadyDisplayed'])) { $GLOBALS['EXT']['news']['alreadyDisplayed'] = []; } $GLOBALS['EXT']['news']['alreadyDisplayed'][$uid] = $uid; // Add localized uid as well $originalUid = (int)$newsItem->_getProperty('_localizedUid'); if ($originalUid > 0) { $GLOBALS['EXT']['news']['alreadyDisplayed'][$originalUid] = $originalUid; } } }