image_module_test.module

Same filename in other branches
  1. 9 core/modules/image/tests/modules/image_module_test/image_module_test.module
  2. 8.9.x 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

modules/image/tests/image_module_test.module

View source
<?php


/**
 * @file
 * Provides Image module hook implementations for testing purposes.
 */
function image_module_test_file_download($uri) {
    if (variable_get('image_module_test_file_download', FALSE) == $uri) {
        return array(
            'X-Image-Owned-By' => 'image_module_test',
        );
    }
    if (variable_get('image_module_test_invalid_headers', FALSE) == $uri) {
        return array(
            'Content-Type' => 'image/png',
        );
    }
}

/**
 * Implements hook_image_effect_info().
 */
function image_module_test_image_effect_info() {
    $effects = array(
        'image_module_test_null' => array(
            'label' => 'image_module_test_null',
            'effect callback' => 'image_module_test_null_effect',
        ),
    );
    return $effects;
}

/**
 * Image effect callback; Null.
 *
 * @param $image
 *   An image object returned by image_load().
 * @param $data
 *   An array with no attributes.
 *
 * @return
 *   TRUE
 */
function image_module_test_null_effect(&$image, array $data) {
    return TRUE;
}

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

Functions

Title Deprecated Summary
image_module_test_file_download @file Provides Image module hook implementations for testing purposes.
image_module_test_image_effect_info Implements hook_image_effect_info().
image_module_test_image_effect_info_alter Implements hook_image_effect_info_alter().
image_module_test_null_effect Image effect callback; Null.

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