/** * Render link to news item or internal/external pages * * @param Tx_MooxNews_Domain_Model_News $newsItem current news object * @param array $settings * @param boolean $uriOnly return only the url without the a-tag * @param array $configuration optional typolink configuration * @return string link */ public function render(Tx_MooxNews_Domain_Model_News $newsItem, array $settings = array(), $uriOnly = FALSE, $configuration = array()) { $tsSettings = $this->pluginSettingsService->getSettings(); // TODO: check why $this->pluginSettingsService->getSettings() get wrong setting if (true || !is_array($tsSettings)) { $tsSettings = $settings; } $this->init(); $newsType = (int) $newsItem->getType(); switch ($newsType) { // internal news case 1: $configuration['parameter'] = $newsItem->getInternalurl(); break; // external news // external news case 2: $configuration['parameter'] = $newsItem->getExternalurl(); break; // normal news record // normal news record default: $configuration = $this->getLinkToNewsItem($newsItem, $tsSettings, $configuration); } if (isset($tsSettings['link']['typesOpeningInNewWindow'])) { if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($tsSettings['link']['typesOpeningInNewWindow'], $newsType)) { $this->tag->addAttribute('target', '_blank'); } } $url = $this->cObj->typoLink_URL($configuration); if ($uriOnly) { return $url; } $this->tag->addAttribute('href', $url); $this->tag->addAttribute('rel', $url); $this->tag->setContent($this->renderChildren()); return $this->tag->render(); }
/** * Test if internalurl can be set * * @test * @return void */ public function internalurlCanBeSet() { $internalurl = 'http://foo.org/'; $this->newsDomainModelInstance->setInternalurl($internalurl); $this->assertEquals($internalurl, $this->newsDomainModelInstance->getInternalurl()); }