function webp_uninstall in WebP 8
Implements hook_uninstall().
File
- ./
webp.install, line 52 - Contains install and update functions for WebP.
Code
function webp_uninstall() {
if (\Drupal::moduleHandler()
->moduleExists('imageapi_optimize')) {
// imageapi_optimize: delete the WebP processor from all pipelines.
$storage = \Drupal::entityTypeManager()
->getStorage('imageapi_optimize_pipeline');
if ($pipelines = $storage
->loadMultiple()) {
/* @var \Drupal\imageapi_optimize\Entity\ImageAPIOptimizePipeline $pipeline */
foreach ($pipelines as $pipeline) {
/* @var \Drupal\imageapi_optimize\ImageAPIOptimizeProcessorPluginCollection $processors */
if ($processors = $pipeline
->getProcessors()) {
/** @var \Drupal\imageapi_optimize\ImageAPIOptimizeProcessorBase $processor */
foreach ($processors as $processor) {
if ($processor
->getPluginId() === 'webp_webp') {
$pipeline
->deleteProcessor($processor);
}
}
}
}
}
}
else {
/* @var \Drupal\webp\Webp $webp */
$webp = \Drupal::service('webp.webp');
$webp
->deleteImageStyleDerivatives();
}
}