1 image.module image_effect_definitions()

Pull in image effects 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()

File

core/modules/image/image.module, line 1171
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->langcode;

  $effects = &backdrop_static(__FUNCTION__);

  if (!isset($effects)) {
    if ($cache = cache()->get("image_effect_definitions:$langcode")) {
      $effects = $cache->data;
    }
    else {
      $effects = array();
      include_once BACKDROP_ROOT . '/core/modules/image/image.effects.inc';
      foreach (module_implements('image_effect_info') as $module) {
        foreach (module_invoke($module, 'image_effect_info') as $name => $effect) {
          $effect['module'] = $module;
          $effect['name'] = $name;
          $effect['data'] = isset($effect['data']) ? $effect['data'] : array();
          $effects[$name] = $effect;
        }
      }
      backdrop_sort($effects, array('name' => SORT_STRING));
      backdrop_alter('image_effect_info', $effects);
      cache()->set("image_effect_definitions:$langcode", $effects);
    }
  }

  return $effects;
}