/**
  * 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();
 }
Exemple #2
0
 /**
  * Test if type can be set
  *
  * @test
  * @return void
  */
 public function typeCanBeSet()
 {
     $type = 123;
     $this->newsDomainModelInstance->setType($type);
     $this->assertEquals($type, $this->newsDomainModelInstance->getType());
 }