/** * Following the previous action, this one will actually parse the content (for both parser). * * @param Request $request * @param Feed $feed The document Feed (retrieving for a ParamConverter with the slug) * * @return string */ public function previewNewAction(Request $request, Feed $feed) { $rssFeed = $this->get('simple_pie_proxy')->setUrl($feed->getLink())->init(); try { $parser = $this->get('content_extractor')->init($request->get('parser'), $feed); } catch (\InvalidArgumentException $e) { throw $this->createNotFoundException($e->getMessage()); } $firstItem = $rssFeed->get_item(0); if (!$firstItem) { throw $this->createNotFoundException('No item found in this feed.'); } $content = $parser->parseContent($firstItem->get_permalink(), $firstItem->get_description()); return $this->render('Api43FeedBundle:FeedItem:content.html.twig', array('title' => html_entity_decode($firstItem->get_title(), ENT_COMPAT, 'UTF-8'), 'content' => $content->content, 'modal' => false, 'url' => $content->url, 'defaultContent' => $content->useDefault)); }