You are here

public static function FeedsPlugin::typeOf in Feeds 8.2

Determines the type of a plugin.

@todo PHP5.3: Implement self::type() and query with $plugin_key::type().

Parameters

$plugin_key: String that identifies a Feeds plugin key.

Return value

One of the following values: 'fetcher' if the plugin is a fetcher 'parser' if the plugin is a parser 'processor' if the plugin is a processor FALSE otherwise.

3 calls to FeedsPlugin::typeOf()
FeedsImporter::setPlugin in lib/Drupal/feeds/FeedsImporter.php
Set plugin.
FeedsPlugin::byType in lib/Drupal/feeds/Plugin/FeedsPlugin.php
Gets all available plugins of a particular type.
FeedsWebTestBase::setPlugin in lib/Drupal/feeds/Tests/FeedsWebTestBase.php
Choose a plugin for a importer configuration and assert it.

File

lib/Drupal/feeds/Plugin/FeedsPlugin.php, line 188
Definition of FeedsPlugin class.

Class

FeedsPlugin
Implement source interface for all plugins.

Namespace

Drupal\feeds\Plugin

Code

public static function typeOf($plugin_key) {
  $fetchers = \Drupal::service('plugin.manager.feeds.fetcher')
    ->getDefinitions();
  if (isset($fetchers[$plugin_key])) {
    return 'fetcher';
  }
  $parsers = \Drupal::service('plugin.manager.feeds.parser')
    ->getDefinitions();
  if (isset($parsers[$plugin_key])) {
    return 'parser';
  }
  $processors = \Drupal::service('plugin.manager.feeds.processor')
    ->getDefinitions();
  if (isset($processors[$plugin_key])) {
    return 'processor';
  }
  return FALSE;
}