function hook_image_style_flush

Same name and namespace in other branches
  1. 11.x core/modules/image/image.api.php \hook_image_style_flush()
  2. 9 core/modules/image/image.api.php \hook_image_style_flush()
  3. 10 core/modules/image/image.api.php \hook_image_style_flush()
  4. 8.9.x core/modules/image/image.api.php \hook_image_style_flush()

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

$style: The image style array that is being flushed.

Related topics

1 function implements hook_image_style_flush()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

ImageModuleTestHooks::imageStyleFlush in core/modules/image/tests/modules/image_module_test/src/Hook/ImageModuleTestHooks.php
Implements hook_image_style_flush().
1 invocation of hook_image_style_flush()
image_style_flush in modules/image/image.module
Flushes cached media for a style.

File

modules/image/image.api.php, line 117

Code

function hook_image_style_flush($style) {
  // Empty cached data that contains information about the style.
  cache_clear_all('*', 'cache_mymodule', TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.