image_module_test.module

Same filename and directory in other branches
  1. 7.x modules/image/tests/image_module_test.module
  2. 9 core/modules/image/tests/modules/image_module_test/image_module_test.module
  3. 10 core/modules/image/tests/modules/image_module_test/image_module_test.module
  4. 11.x core/modules/image/tests/modules/image_module_test/image_module_test.module

Provides Image module hook implementations for testing purposes.

File

core/modules/image/tests/modules/image_module_test/image_module_test.module

View source
<?php


/**
 * @file
 * Provides Image module hook implementations for testing purposes.
 */
use Drupal\image\ImageStyleInterface;
function image_module_test_file_download($uri) {
    $default_uri = \Drupal::state()->get('image.test_file_download') ?: FALSE;
    if ($default_uri == $uri) {
        return [
            'X-Image-Owned-By' => 'image_module_test',
        ];
    }
}

/**
 * Implements hook_image_effect_info_alter().
 *
 * Used to keep a count of cache misses in \Drupal\image\ImageEffectManager.
 */
function image_module_test_image_effect_info_alter(&$effects) {
    $image_effects_definition_called =& drupal_static(__FUNCTION__, 0);
    $image_effects_definition_called++;
}

/**
 * Implements hook_image_style_presave().
 *
 * Used to save test third party settings in the image style entity.
 */
function image_module_test_image_style_presave(ImageStyleInterface $style) {
    $style->setThirdPartySetting('image_module_test', 'foo', 'bar');
}

Functions

Title Deprecated Summary
image_module_test_file_download
image_module_test_image_effect_info_alter Implements hook_image_effect_info_alter().
image_module_test_image_style_presave Implements hook_image_style_presave().

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