You are here

public function FeedsSource::preview in Feeds 6

Same name and namespace in other branches
  1. 7.2 includes/FeedsSource.inc \FeedsSource::preview()
  2. 7 includes/FeedsSource.inc \FeedsSource::preview()

Preview = fetch and parse a feed.

Return value

FeedsImportBatch object, fetched and parsed.

Throws

Throws Exception if an error occurs when fetching or parsing.

File

includes/FeedsSource.inc, line 121
Definition of FeedsSourceInterface and FeedsSource class.

Class

FeedsSource
This class encapsulates a source of a feed. It stores where the feed can be found and how to import it.

Code

public function preview() {
  $this->batch = $this->importer->fetcher
    ->fetch($this);
  $this->importer->parser
    ->parse($this->batch, $this);
  module_invoke_all('feeds_after_parse', $this->importer, $this);
  $batch = $this->batch;
  unset($this->batch);
  return $batch;
}