You are here

function scald_scald_prerender in Scald: Media Management made easy 7

Same name and namespace in other branches
  1. 6 scald.module \scald_scald_prerender()

Implements hook_scald_prerender().

Scald Core implements this hook for its role as a Scald Context Provider of Scald Contexts 'no-access', 'invalid-id', 'deleted', 'title' and UI-created contexts, and for its role as a Scald Transcoder Provider of Scald Transcoder 'passthrough'.

File

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

Code

function scald_scald_prerender($atom, $context, $options, $mode) {
  switch ($mode) {
    case 'type':
      if ($atom->type == 'image' && !isset($atom->rendered->player)) {
        $url = isset($atom->rendered->file_transcoded_url) ? $atom->rendered->file_transcoded_url : $atom->rendered->file_source_url;
        $atom->rendered->player = theme('image', array(
          'path' => $url,
        ));
      }
      break;
    case 'context':
      break;
    case 'transcoder':
      if (!empty($atom->file_source)) {
        $atom->rendered->file_transcoded_url = file_create_url($atom->file_source);
      }
      break;
    case 'player':
      break;
  }
}