Implements \Drupal\aggregator\Plugin\ParserInterface::parse().
Overrides ParserInterface::parse
public function parse(Feed $feed) {
// Filter the input data.
if ($this
->parseFeed($feed->source_string, $feed)) {
// Prepare the channel data.
foreach ($this->channel as $key => $value) {
$this->channel[$key] = trim($value);
}
// Prepare the image data (if any).
foreach ($this->image as $key => $value) {
$this->image[$key] = trim($value);
}
// Add parsed data to the feed object.
$feed->link->value = !empty($channel['link']) ? $channel['link'] : '';
$feed->description->value = !empty($channel['description']) ? $channel['description'] : '';
$feed->image->value = !empty($image['url']) ? $image['url'] : '';
// Clear the page and block caches.
cache_invalidate_tags(array(
'content' => TRUE,
));
return TRUE;
}
return FALSE;
}