W3cubDocs

/Drupal 8

function hook_image_style_flush

hook_image_style_flush($style)

Respond to image style flushing.

This hook enables modules to take effect when a style is being flushed (all images are being deleted from the server and regenerated). Any module-specific caches that contain information related to the style should be cleared using this hook. This hook is called whenever a style is updated, deleted, or any effect associated with the style is update or deleted.

Parameters

\Drupal\image\ImageStyleInterface $style: The image style object that is being flushed.

Related topics

Hooks
Define functions that alter the behavior of Drupal core.

File

core/modules/image/image.api.php, line 36
Hooks related to image styles and effects.

Code

function hook_image_style_flush($style) {
  // Empty cached data that contains information about the style.
  \Drupal::cache('mymodule')->deleteAll();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!image!image.api.php/function/hook_image_style_flush/8.1.x