Version 1
[yaffs-website] / web / core / modules / image / tests / modules / image_module_test / image_module_test.module
1 <?php
2
3 /**
4  * @file
5  * Provides Image module hook implementations for testing purposes.
6  */
7
8 use Drupal\image\ImageStyleInterface;
9
10 function image_module_test_file_download($uri) {
11   $default_uri = \Drupal::state()->get('image.test_file_download') ?: FALSE;
12   if ($default_uri == $uri) {
13     return ['X-Image-Owned-By' => 'image_module_test'];
14   }
15 }
16
17 /**
18  * Implements hook_image_effect_info_alter().
19  *
20  * Used to keep a count of cache misses in \Drupal\image\ImageEffectManager.
21  */
22 function image_module_test_image_effect_info_alter(&$effects) {
23   $image_effects_definition_called = &drupal_static(__FUNCTION__, 0);
24   $image_effects_definition_called++;
25 }
26
27 /**
28  * Implements hook_image_style_presave().
29  *
30  * Used to save test third party settings in the image style entity.
31  */
32 function image_module_test_image_style_presave(ImageStyleInterface $style) {
33   $style->setThirdPartySetting('image_module_test', 'foo', 'bar');
34 }