You are here

public function AssetFileStorage::deleteFiles in Asset Injector 8

Same name and namespace in other branches
  1. 8.2 src/AssetFileStorage.php \Drupal\asset_injector\AssetFileStorage::deleteFiles()

Delete files for an asset.

Yes, we can have multiple files for an asset configuration, if we have overrides.

File

src/AssetFileStorage.php, line 66

Class

AssetFileStorage
Class AssetFileStorage.

Namespace

Drupal\asset_injector

Code

public function deleteFiles() {
  $pattern = $this
    ->internalFileUri(TRUE);
  $paths = glob($pattern);
  foreach ($paths as $path) {
    file_unmanaged_delete($path);
  }
}