function 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()

3 calls to image_effect_definitions()
ImageEffectsTest::testImageEffectsCaching in drupal/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php
Test image effect caching.
image_effect_definition_load in drupal/core/modules/image/image.module
Load the definition for an image effect.
image_style_form in drupal/core/modules/image/image.admin.inc
Form builder; Edit an image style name and effects order.
1 string reference to 'image_effect_definitions'
ImageEffectsTest::testImageEffectsCaching in drupal/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php
Test image effect caching.

File

drupal/core/modules/image/image.module, line 904
Exposes global functionality for creating image styles.

Code

function image_effect_definitions() {
  $language_interface = language(LANGUAGE_TYPE_INTERFACE);

  // hook_image_effect_info() includes translated strings, so each language is
  // cached separately.
  $langcode = $language_interface->langcode;
  $effects =& drupal_static(__FUNCTION__);
  if (!isset($effects)) {
    if ($cache = cache()
      ->get("image_effects:{$langcode}")) {
      $effects = $cache->data;
    }
    else {
      $effects = array();
      include_once DRUPAL_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) {

          // 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;
}