You are here

function scald_scald_contexts_alter in Scald: Media Management made easy 7

Implements hook_scald_contexts_alter().

Adds informations on the configured transcoder formats to the standard info hook output.

File

./scald.module, line 147
The Scald Core, which handles all Scald Registries and dispatch.

Code

function scald_scald_contexts_alter(&$contexts) {
  ctools_include('export');
  foreach (ctools_export_crud_load_all('scald_context_config') as $name => $config) {

    // Only add formats informations to context that got exposed.
    if (!empty($contexts[$name])) {

      // This is the old and deprecated structure.
      foreach ($config->transcoder as $type => $transcoder) {
        if ($transcoder['*'] == 'style-Library') {
          $transcoder['*'] = 'style-library';
          $config->transcoder[$type]['*'] = 'style-library';
        }
        $contexts[$name]['type_format'][$type] = array(
          'file_format' => '*',
          'transcoder' => $transcoder['*'],
        );
      }

      // The new structure.
      $contexts[$name]['transcoder'] = $config->transcoder;
      $contexts[$name]['player'] = $config->player;
    }
  }
}