/**
  * Renders an RSS feed
  *
  * @return string
  */
 public function rssAction()
 {
     /** @var NodeInterface $blogDocumentNode */
     $rssDocumentNode = $this->request->getInternalArgument('__documentNode');
     if ($rssDocumentNode === NULL) {
         return 'Error: The Blog Post Plugin cannot determine the current document node. Please make sure to include this plugin only by inserting it into a page / document.';
     }
     $blogDocumentNode = $rssDocumentNode->getParent();
     $uriBuilder = new UriBuilder();
     $uriBuilder->setRequest($this->request->getMainRequest());
     $uriBuilder->setCreateAbsoluteUri(TRUE);
     if ($this->settings['feed']['uri'] !== '') {
         $feedUri = $this->settings['feed']['uri'];
     } else {
         $uriBuilder->setFormat('xml');
         $feedUri = $uriBuilder->uriFor('show', array('node' => $rssDocumentNode), 'Frontend\\Node', 'TYPO3.Neos');
     }
     $channel = new Channel();
     $channel->setTitle($this->settings['feed']['title']);
     $channel->setDescription($this->settings['feed']['description']);
     $channel->setFeedUri($feedUri);
     $channel->setWebsiteUri($this->request->getHttpRequest()->getBaseUri());
     $channel->setLanguage((string) $this->i18nService->getConfiguration()->getCurrentLocale());
     foreach ($blogDocumentNode->getChildNodes('RobertLemke.Plugin.Blog:Post') as $postNode) {
         /* @var $postNode NodeInterface */
         $uriBuilder->setFormat('html');
         $postUri = $uriBuilder->uriFor('show', array('node' => $postNode), 'Frontend\\Node', 'TYPO3.Neos');
         $item = new Item();
         $item->setTitle($postNode->getProperty('title'));
         $item->setGuid($postNode->getIdentifier());
         // TODO: Remove this once all old node properties are migrated:
         $publicationDate = $postNode->getProperty('datePublished');
         if (is_string($publicationDate)) {
             $publicationDate = \DateTime::createFromFormat('Y-m-d', $publicationDate);
             $postNode->setProperty('datePublished', $publicationDate);
         }
         $item->setPublicationDate($postNode->getProperty('datePublished'));
         $item->setItemLink((string) $postUri);
         $item->setCommentsLink((string) $postUri . '#comments');
         // TODO: Remove this once all old node properties are migrated:
         $author = $postNode->getProperty('author');
         if ($author === NULL) {
             $author = 'Robert Lemke';
             $postNode->setProperty('author', $author);
         }
         $item->setCreator($author);
         #			$item->setCategories(array('test'));
         $description = $this->contentService->renderTeaser($postNode) . ' <a href="' . $postUri . '">Read more</a>';
         $item->setDescription($description);
         $channel->addItem($item);
     }
     // This won't work yet (plugin sub responses can't set headers yet) but keep that as a reminder:
     $headers = $this->response->getHeaders();
     $headers->setCacheControlDirective('s-max-age', 3600);
     $headers->set('Content-Type', 'application/rss+xml');
     $feed = new Feed();
     $feed->addChannel($channel);
     return $feed->render();
 }
 /**
  * Render a teaser
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
  * @return string cropped text
  */
 public function render(NodeInterface $node)
 {
     return $this->contentService->renderTeaser($node);
 }