Closed waldo2188 closed 12 years ago
Hi,
To add a new custom field, you juste have to do something like defined in the documentation.
<?php
$feed = $this->get('eko_feed.feed.manager')->get('article');
$feed->addField(new Field('category', 'getFeedItemCategory'));
Then you have to define the getFeedItemCategory()
method in your entity.
<?php
public function getFeedItemCategory()
{
return 'Your category';
}
The category node will be displayed like that:
<item>
<title><![CDATA[My title]]></title>
<description><![CDATA[My description]]></description>
<link>http://github.com/eko/FeedBundle</link>
<pubDate>Sat, 07 Nov 2009 16:26:58 +0100</pubDate>
<category>My category</category>
</item>
Does this explanation has answered your question?
That's the way i've followed. But the code throw this error :
Fatal error: Call to undefined method Eko\FeedBundle\Item\ProxyItem::getFeedItemCategory() in /home/waldo/www/projetx/vendor/eko/feedbundle/Eko/FeedBundle/Formatter/Formatter.php on line 72
Indeed, there is a bug adding custom fields when implementing RoutedItemInterface
. I'm working on a fix as soon as possible.
Thank you for reporting this issue!
This bug is now fixed, you can update sources and your custom field should work now.
Thank your for your report and have a great time with FeedBundle :)
Salut, Pouvez-vous expliquer comment ajouter de nouveaux champs. J'aimerai ajouter plusieurs élément "category" dans les éléments "item".
Merci.
Hy !
Can you add some explanation about the possibility of adding new field? I want to add multiple field "category" into the "item" element.
Thanks