You are here

function feeds_plugin in Feeds 7.2

Same name and namespace in other branches
  1. 8.2 feeds.module \feeds_plugin()
  2. 7 feeds.module \feeds_plugin()

Gets an instance of a class for a given plugin and id.

Parameters

string $plugin: A string that is the key of the plugin to load.

string $id: A string that is the id of the object.

Return value

FeedsPlugin A FeedsPlugin object.

Related topics

8 calls to feeds_plugin()
FeedsImporter::setPlugin in includes/FeedsImporter.inc
Set plugin.
FeedsImporter::validateConfig in includes/FeedsImporter.inc
Validates the configuration.
FeedsImporter::__construct in includes/FeedsImporter.inc
Instantiate class variables, initialize and configure plugins.
feeds_push_unsubscribe in ./feeds.module
Scheduler callback for unsubscribing from PuSH hubs.
feeds_rules_event_info in ./feeds.rules.inc
Implements hook_rules_event_info().

... See full list

File

./feeds.module, line 1286
Feeds - basic API functions and hook implementations.

Code

function feeds_plugin($plugin, $id) {
  ctools_include('plugins');
  if ($class = ctools_plugin_load_class('feeds', 'plugins', $plugin, 'handler')) {
    return FeedsPlugin::instance($class, $id, ctools_get_plugins('feeds', 'plugins', $plugin));
  }
  $args = array(
    '%plugin' => $plugin,
    '@id' => $id,
  );
  if (user_access('administer feeds')) {
    if (module_exists('feeds_ui')) {
      $args['@link'] = url('admin/structure/feeds/' . $id);
      drupal_set_message(t('Missing Feeds plugin %plugin. See <a href="@link">@id</a>. Check whether all required libraries and modules are installed properly.', $args), 'warning', FALSE);
    }
    else {
      drupal_set_message(t('Missing Feeds plugin %plugin used by the importer "@id". Check whether all required libraries and modules are installed properly. Enable the Feeds Admin UI module to check the importer\'s settings.', $args), 'warning', FALSE);
    }
  }
  else {
    drupal_set_message(t('Missing Feeds plugin %plugin. Please contact your site administrator.', $args), 'warning', FALSE);
  }
  $class = ctools_plugin_load_class('feeds', 'plugins', 'FeedsMissingPlugin', 'handler');
  return FeedsPlugin::instance($class, $id);
}