You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, Contao (a CMS based on the Symfony framework) uses FeedIo to generate XML feeds of the news articles. The feeds are created in the NewsFeedListener.
It is possible to change the automatically generated feed content by overwriting elements with an TransformArticleForFeed EventListener. All methods defined by FeedIo are available or can be used in the EventListener.
For example, you can remove the author of an article from the output XML by adding $item->setAuthor(null); in the EventListener.
Now I'm trying to remove the <enclosure> (media) elements, that have been added by Contao to the XML file.
It is possible to declare all media attributes with empty values like this:
This will result in <enclosure url="" type="" length=""/> in the XML output.
Unfortunatelly I could not find a method to completly remove the <enclosure> (media), because FeedIo only has addMedia(), getMedias(), hasMedia() and newMedia(), but nothing like removeMedia() or deleteMedia().
Is there another way to remove the media that have already been added to the item object?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, Contao (a CMS based on the Symfony framework) uses FeedIo to generate XML feeds of the news articles. The feeds are created in the NewsFeedListener.
It is possible to change the automatically generated feed content by overwriting elements with an TransformArticleForFeed EventListener. All methods defined by FeedIo are available or can be used in the EventListener.
For example, you can remove the author of an article from the output XML by adding
$item->setAuthor(null);
in the EventListener.Now I'm trying to remove the
<enclosure>
(media) elements, that have been added by Contao to the XML file.It is possible to declare all media attributes with empty values like this:
This will result in
<enclosure url="" type="" length=""/>
in the XML output.Unfortunatelly I could not find a method to completly remove the
<enclosure>
(media), because FeedIo only hasaddMedia()
,getMedias()
,hasMedia()
andnewMedia()
, but nothing likeremoveMedia()
ordeleteMedia()
.Is there another way to remove the media that have already been added to the item object?
Beta Was this translation helpful? Give feedback.
All reactions