You are here

function file_effect_definitions in Styles 7

Pull in file effects exposed by modules implementing hook_file_effect_info().

Return value

An array of file effects to be used when transforming file.

See also

hook_file_effect_info()

file_effect_definition_load()

1 call to file_effect_definitions()
file_style_form in contrib/file_styles/file_styles.admin.inc
Form builder; Edit a file style name and effects order.

File

contrib/file_styles/file_styles.module, line 606
File widget formatter definitions.

Code

function file_effect_definitions() {
  $effects =& drupal_static(__FUNCTION__);
  if (!isset($effects)) {
    if ($cache = cache_get('file_effects') && !empty($cache->data)) {
      $effects = $cache->data;
    }
    else {
      $effects = array();
      module_load_include('inc', 'file_styles', 'file_styles.effects');
      foreach (module_implements('file_effect_info') as $module) {
        foreach (module_invoke($module, 'file_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, '_file_effect_definitions_sort');
      cache_set('file_effects', $effects);
    }
  }
  return $effects;
}