Construct a formatter with given feed.
public __construct ( Symfony\Component\Translation\TranslatorInterface $translator, string | null $domain = null ) | ||
$translator | Symfony\Component\Translation\TranslatorInterface | A Symfony translator service instance |
$domain | string | null | A Symfony translation domain |
/** * Construct a formatter with given feed * * @param Feed $feed A feed instance */ public function __construct(Feed $feed) { $this->fields = array(new Field('id', 'getFeedItemLink', array('cdata' => false)), new Field('title', 'getFeedItemTitle', array('cdata' => true)), new Field('summary', 'getFeedItemDescription', array('cdata' => true)), new Field('link', 'getFeedItemLink', array('attribute' => true, 'attribute_name' => 'href')), new Field('updated', 'getFeedItemPubDate', array('date_format' => \DateTime::ATOM))); $author = $feed->get('author'); if (empty($author)) { throw new \InvalidArgumentException('Atom formatter requires an "author" parameter in configuration.'); } parent::__construct($feed); $this->initialize(); }
/** * Construct a formatter with given feed * * @param TranslatorInterface $translator A Symfony translator service instance * @param string|null $domain A Symfony translation domain * * @throws \InvalidArgumentException if author is not filled in bundle configuration */ public function __construct(TranslatorInterface $translator, $domain = null) { $this->itemFields = array(new ItemField('id', 'getFeedItemLink', array('cdata' => false)), new ItemField('title', 'getFeedItemTitle', array('cdata' => true)), new ItemField('summary', 'getFeedItemDescription', array('cdata' => true), array('type' => 'html')), new ItemField('link', 'getFeedItemLink', array('attribute' => true, 'attribute_name' => 'href')), new ItemField('updated', 'getFeedItemPubDate', array('date_format' => \DateTime::ATOM))); parent::__construct($translator, $domain); }
/** * Construct a formatter with given feed * * @param Feed $feed A feed instance */ public function __construct(Feed $feed) { $this->fields = array(new Field('title', 'getFeedItemTitle', array('cdata' => true)), new Field('description', 'getFeedItemDescription', array('cdata' => true)), new Field('link', 'getFeedItemLink'), new Field('pubDate', 'getFeedItemPubDate', array('date_format' => \DateTime::RSS))); parent::__construct($feed); $this->initialize(); }
/** * Construct a formatter with given feed * * @param TranslatorInterface $translator A Symfony translator service instance * @param string|null $domain A Symfony translation domain */ public function __construct(TranslatorInterface $translator, $domain = null) { $this->itemFields = array(new ItemField('title', 'getFeedItemTitle', array('cdata' => true)), new ItemField('description', 'getFeedItemDescription', array('cdata' => true)), new ItemField('link', 'getFeedItemLink'), new ItemField('pubDate', 'getFeedItemPubDate', array('date_format' => \DateTime::RSS))); parent::__construct($translator, $domain); }