You are here

public function FeedType::getSourcePlugin in Feeds 8.3

@todo Use plugin bag.

Overrides FeedTypeInterface::getSourcePlugin

File

src/Entity/FeedType.php, line 492

Class

FeedType
Defines the Feeds feed type entity.

Namespace

Drupal\feeds\Entity

Code

public function getSourcePlugin($source) {
  if (!isset($this->sourcePlugins[$source])) {
    $sources = $this
      ->getMappingSources();

    // The source is a plugin.
    if (isset($sources[$source]['id'])) {
      $configuration = [
        'feed_type' => $this,
        'source' => $source,
      ];
      $this->sourcePlugins[$source] = $this
        ->getSourcePluginManager()
        ->createInstance($sources[$source]['id'], $configuration);
    }
    else {
      $this->sourcePlugins[$source] = FALSE;
    }
  }
  return $this->sourcePlugins[$source];
}