You are here

function image_effect_definitions in Drupal 7

Returns a set of image effects.

These image effects are exposed by modules implementing hook_image_effect_info().

Return value

An array of image effects to be used when transforming images.

See also

hook_image_effect_info()

image_effect_definition_load()

3 calls to image_effect_definitions()
ImageEffectsUnitTest::testImageEffectsCaching in modules/image/image.test
Test image effect caching.
image_effect_definition_load in modules/image/image.module
Loads the definition for an image effect.
image_style_form in modules/image/image.admin.inc
Form builder; Edit an image style name and effects order.
1 string reference to 'image_effect_definitions'
ImageEffectsUnitTest::testImageEffectsCaching in modules/image/image.test
Test image effect caching.

File

modules/image/image.module, line 1158
Exposes global functionality for creating image styles.

Code

function image_effect_definitions() {
  global $language;

  // hook_image_effect_info() includes translated strings, so each language is
  // cached separately.
  $langcode = $language->language;
  $effects =& drupal_static(__FUNCTION__);
  if (!isset($effects)) {
    if ($cache = cache_get("image_effects:{$langcode}")) {
      $effects = $cache->data;
    }
    else {
      $effects = array();
      include_once DRUPAL_ROOT . '/modules/image/image.effects.inc';
      foreach (module_implements('image_effect_info') as $module) {
        foreach (module_invoke($module, 'image_effect_info') as $name => $effect) {

          // Ensure the current toolkit supports the effect.
          $effect['module'] = $module;
          $effect['name'] = $name;
          $effect['data'] = isset($effect['data']) ? $effect['data'] : array();
          $effects[$name] = $effect;
        }
      }
      uasort($effects, '_image_effect_definitions_sort');
      drupal_alter('image_effect_info', $effects);
      cache_set("image_effects:{$langcode}", $effects);
    }
  }
  return $effects;
}