FlysystemPluginManager.php in Flysystem 3.x
File
src/Plugin/FlysystemPluginManager.php
View source
<?php
namespace Drupal\flysystem\Plugin;
use Drupal\Component\Plugin\FallbackPluginManagerInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
class FlysystemPluginManager extends DefaultPluginManager implements FallbackPluginManagerInterface {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Flysystem', $namespaces, $module_handler, 'Drupal\\flysystem\\Plugin\\FlysystemPluginInterface', 'Drupal\\flysystem\\Annotation\\Adapter');
$this
->setCacheBackend($cache_backend, 'flysystem_plugins');
}
public function getFallbackPluginId($plugin_id, array $configuration = []) {
return 'missing';
}
protected function alterDefinitions(&$definitions) {
foreach ($definitions as $id => $definition) {
foreach ($definition['extensions'] as $extension) {
if (extension_loaded($extension)) {
continue;
}
unset($definitions[$id]);
break;
}
}
parent::alterDefinitions($definitions);
}
}