Commit 5400ab7d authored by Steven Jones's avatar Steven Jones Committed by Steven Jones
Browse files

Issue #2806803 by Steven Jones: Flush image styles using a pipeline after the...

Issue #2806803 by Steven Jones: Flush image styles using a pipeline after the pipeline is being saved
parent 20848145
......@@ -105,7 +105,7 @@ class ImageAPIOptimizePipeline extends ConfigEntityBase implements ImageAPIOptim
}
}
else {
// Flush image style when updating without changing the name.
// Flush pipeline when updating without changing the name.
$this->flush();
}
}
......@@ -145,6 +145,15 @@ class ImageAPIOptimizePipeline extends ConfigEntityBase implements ImageAPIOptim
*/
public function flush() {
// Get all image styles and if they use this pipeline, flush it.
$style_storage = $this->entityTypeManager()->getStorage('image_style');
foreach ($style_storage->loadMultiple() as $style) {
/** @var ImageStyleWithPipeline $style */
if ($style->hasPipeline() && $style->getPipelineEntity()->id() == $this->id()) {
$style->flush();
}
}
// Let other modules update as necessary on flush.
$module_handler = \Drupal::moduleHandler();
$module_handler->invokeAll('imageapi_optimize_pipeline_flush', array($this));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment