You are here

protected function FlysystemPluginManager::alterDefinitions in Flysystem 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/FlysystemPluginManager.php \Drupal\flysystem\Plugin\FlysystemPluginManager::alterDefinitions()
  2. 3.x src/Plugin/FlysystemPluginManager.php \Drupal\flysystem\Plugin\FlysystemPluginManager::alterDefinitions()
  3. 3.0.x src/Plugin/FlysystemPluginManager.php \Drupal\flysystem\Plugin\FlysystemPluginManager::alterDefinitions()

Invokes the hook to alter the definitions if the alter hook is set.

Parameters

$definitions: The discovered plugin definitions.

Overrides DefaultPluginManager::alterDefinitions

File

src/Plugin/FlysystemPluginManager.php, line 41

Class

FlysystemPluginManager
Manages Flysystem plugins.

Namespace

Drupal\flysystem\Plugin

Code

protected function alterDefinitions(&$definitions) {

  // Remove definitions that are missing necessary extensions.
  foreach ($definitions as $id => $definition) {
    foreach ($definition['extensions'] as $extension) {
      if (extension_loaded($extension)) {
        continue;
      }
      unset($definitions[$id]);
      break;
    }
  }
  parent::alterDefinitions($definitions);
}