function flysystem_get_plugin in Flysystem 7
Returns a plugin instance.
Parameters
string $id: The plugin id.
array $configuration: (optional) The plugin configuration array.
Return value
\Drupal\flysystem\Plugin\FlysystemPluginInterface|false A flysystem plugin, or false on failure.
1 call to flysystem_get_plugin()
- FlysystemFactory::getPlugin in src/
FlysystemFactory.php - Returns the plugin for a scheme.
File
- ./
flysystem.module, line 189 - Provides access to various filesystem backends using Flysystem.
Code
function flysystem_get_plugin($id, array $configuration = array()) {
if ($definition = flysystem_get_plugin_definition($id)) {
$class = $definition['class'];
if (class_exists($class)) {
return $class::create($configuration);
}
}
// We couldn't find the plugin.
watchdog('flysystem', 'Unable to find the plugin: @id', array(
'@id' => $id,
), WATCHDOG_ALERT);
// Avoid infinite loop.
if ($id === 'missing') {
return FALSE;
}
return flysystem_get_plugin('missing');
}