protected static function generateArrowNavigation($objCurrentArchive, $strUrl, $modalId) { $objT = new \FrontendTemplate('navigation_arrows'); // get ids from NewsPlus::getAllNews $session = \Session::getInstance()->getData(); $arrIds = $session[NEWSPLUS_SESSION_NEWS_IDS]; if (count($arrIds) < 1) { return ''; } $prevID = null; $nextID = null; $currentIndex = array_search($objCurrentArchive->id, $arrIds); // prev only of not first item if (isset($arrIds[$currentIndex - 1])) { $prevID = $arrIds[$currentIndex - 1]; $objNews = NewsPlusModel::findByPk($prevID, array()); if ($objNews !== null) { $objT->prev = static::getNewsDetails($objNews, $strUrl, $modalId); $objT->prevLink = $GLOBALS['TL_LANG']['news_plus']['prevLink']; } } // next only of not last item if (isset($arrIds[$currentIndex + 1])) { $nextID = $arrIds[$currentIndex + 1]; $objNews = NewsPlusModel::findByPk($nextID, array()); if ($objNews !== null) { $objT->next = static::getNewsDetails($objNews, $strUrl, $modalId); $objT->nextLink = $GLOBALS['TL_LANG']['news_plus']['nextLink']; } } return $objT->parse(); }