You are here

public function SchemeExtensionTrait::getSchemeForExtension in Flysystem 8

Same name and namespace in other branches
  1. 3.x src/Asset/SchemeExtensionTrait.php \Drupal\flysystem\Asset\SchemeExtensionTrait::getSchemeForExtension()
  2. 2.0.x src/Asset/SchemeExtensionTrait.php \Drupal\flysystem\Asset\SchemeExtensionTrait::getSchemeForExtension()
  3. 3.0.x src/Asset/SchemeExtensionTrait.php \Drupal\flysystem\Asset\SchemeExtensionTrait::getSchemeForExtension()

Returns the scheme that should serve an extension.

Parameters

string $extension: The extension.

Return value

string The scheme that should serve the extension.

4 calls to SchemeExtensionTrait::getSchemeForExtension()
AssetDumper::dump in src/Asset/AssetDumper.php
The file name for the CSS or JS cache file is generated from the hash of the aggregated contents of the files in $data. This forces proxies and browsers to download new CSS when the CSS changes.
CssCollectionOptimizer::deleteAll in src/Asset/CssCollectionOptimizer.php
Deletes all optimized asset collections assets.
FlysystemServiceProvider::swapDumper in src/FlysystemServiceProvider.php
Swaps the js/css dumper if a scheme is configured to serve it.
JsCollectionOptimizer::deleteAll in src/Asset/JsCollectionOptimizer.php
Deletes all optimized asset collections assets.

File

src/Asset/SchemeExtensionTrait.php, line 21

Class

SchemeExtensionTrait
Flysystem dependency injection container.

Namespace

Drupal\flysystem\Asset

Code

public function getSchemeForExtension($extension) {
  $extension_scheme = 'public';
  foreach (Settings::get('flysystem', []) as $scheme => $configuration) {
    if (!empty($configuration['serve_' . $extension]) && !empty($configuration['driver'])) {

      // Don't break, the last configured one will win.
      $extension_scheme = $scheme;
    }
  }
  return $extension_scheme;
}