You are here

function imageinfo_cache_theme_registry_alter in Imageinfo Cache 6.2

Same name and namespace in other branches
  1. 6 imageinfo_cache.module \imageinfo_cache_theme_registry_alter()

Implements hook_theme_registry_alter().

File

./imageinfo_cache.module, line 284
Cache image info for theme_imagecache & theme_imagefield_image.

Code

function imageinfo_cache_theme_registry_alter(&$theme_registry) {

  // Modify the imagecache theme callback.
  if (variable_get('imageinfo_cache_theme_imagecache', IMAGEINFO_CACHE_THEME_IMAGECACHE) && isset($theme_registry['imagecache'])) {

    // Get old theme registry function call.
    variable_set('imageinfo_cache_theme_imagecache_callback', $theme_registry['imagecache']['function']);

    // Set it to our new function that includes caching.
    $theme_registry['imagecache']['function'] = 'imageinfo_cache_theme_imagecache';
  }

  // Modify the imagefield_image theme callback.
  if (variable_get('imageinfo_cache_theme_imagefield_image', IMAGEINFO_CACHE_THEME_IMAGEFIELD_IMAGE) && isset($theme_registry['imagefield_image'])) {

    // Get old theme registry function call.
    variable_set('imageinfo_cache_theme_imagefield_image_callback', $theme_registry['imagefield_image']['function']);

    // Set it to our new function that includes caching.
    $theme_registry['imagefield_image']['function'] = 'imageinfo_cache_theme_imagefield_image';
  }
}