You are here

public function FeedsSource::existing in Feeds 6

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

Only return source if configuration is persistent and valid.

Overrides FeedsConfigurable::existing

See also

FeedsConfigurable::existing().

File

includes/FeedsSource.inc, line 293
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 existing() {

  // If there is no feed nid given, there must be no content type specified.
  // If there is a feed nid given, there must be a content type specified.
  // Ensure that importer is persistent (= defined in code or DB).
  // Ensure that source is persistent (= defined in DB).
  if (empty($this->feed_nid) && empty($this->importer->config['content_type']) || !empty($this->feed_nid) && !empty($this->importer->config['content_type'])) {
    $this->importer
      ->existing();
    return parent::existing();
  }
  throw new FeedsNotExistingException(t('Source configuration not valid.'));
}