public function TestFetcher::fetch in Drupal 9
Same name and namespace in other branches
- 8 core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/fetcher/TestFetcher.php \Drupal\aggregator_test\Plugin\aggregator\fetcher\TestFetcher::fetch()
Downloads feed data.
Parameters
\Drupal\aggregator\FeedInterface $feed: A feed object representing the resource to be downloaded. $feed->getUrl() contains the link to the feed. Download the data at the URL and expose it to other modules by attaching it to $feed->source_string.
Return value
bool TRUE if fetching was successful, FALSE otherwise.
Overrides DefaultFetcher::fetch
File
- core/
modules/ aggregator/ tests/ modules/ aggregator_test/ src/ Plugin/ aggregator/ fetcher/ TestFetcher.php, line 25
Class
- TestFetcher
- Defines a test fetcher implementation.
Namespace
Drupal\aggregator_test\Plugin\aggregator\fetcherCode
public function fetch(FeedInterface $feed) {
if ($feed
->label() == 'Do not fetch') {
return FALSE;
}
return parent::fetch($feed);
}