You are here

public static function FeedsSource::instance in Feeds 7.2

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

Instantiates an unique FeedsSource per class, importer ID and Feed node ID.

Don't use this method directly, use feeds_source() instead.

Parameters

string $importer_id: The machine name of the importer.

int $feed_nid: The node id of a feed node if the source is attached to a feed node.

FeedsAccountSwitcherInterface $account_switcher: The account switcher to use to be able to perform actions as a different user.

Overrides FeedsConfigurable::instance

4 calls to FeedsSource::instance()
FeedsMapperTaxonomyTestCase::testAllowedVocabularies in tests/feeds_mapper_taxonomy.test
Tests that only term references are added from allowed vocabularies.
FeedsMapperTaxonomyTestCase::testSearchByGUID in tests/feeds_mapper_taxonomy.test
Tests mapping to a taxonomy term's guid.
FeedsMapperTaxonomyTestCase::testSearchByID in tests/feeds_mapper_taxonomy.test
Tests mapping to taxonomy terms by tid.
feeds_source in ./feeds.module
Gets an instance of a source object.

File

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

Class

FeedsSource
Holds the source of a feed to import.

Code

public static function instance($importer_id, $feed_nid, FeedsAccountSwitcherInterface $account_switcher = NULL) {
  $class = variable_get('feeds_source_class', 'FeedsSource');
  $instances =& drupal_static(__METHOD__, array());
  if (!isset($instances[$class][$importer_id][$feed_nid])) {
    $instances[$class][$importer_id][$feed_nid] = new $class($importer_id, $feed_nid, $account_switcher);
  }
  return $instances[$class][$importer_id][$feed_nid];
}