function feeds_plugin in Feeds 7
Same name and namespace in other branches
- 8.2 feeds.module \feeds_plugin()
- 7.2 feeds.module \feeds_plugin()
Gets an instance of a class for a given plugin and id.
Parameters
$plugin: A string that is the key of the plugin to load.
$id: A string that is the id of the object.
Return value
A FeedsPlugin object.
Throws
Exception If plugin can't be instantiated.
Related topics
3 calls to feeds_plugin()
- FeedsImporter::setPlugin in includes/
FeedsImporter.inc - Set plugin.
- FeedsImporter::__construct in includes/
FeedsImporter.inc - Instantiate class variables, initialize and configure plugins.
- feeds_ui_edit_page in feeds_ui/
feeds_ui.admin.inc - Edit feed configuration.
File
- ./
feeds.module, line 756 - 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 FeedsConfigurable::instance($class, $id);
}
$args = array(
'%plugin' => $plugin,
);
if (user_access('administer feeds')) {
$args['!link'] = l($id, 'admin/structure/feeds/edit/' . $id);
drupal_set_message(t('Missing Feeds plugin %plugin. See !link. Check whether all required libraries and modules are installed properly.', $args), 'warning');
}
else {
drupal_set_message(t('Missing Feeds plugin %plugin. Please contact your site administrator.', $args), 'warning');
}
$class = ctools_plugin_load_class('feeds', 'plugins', 'FeedsMissingPlugin', 'handler');
return FeedsConfigurable::instance($class, $id);
}