You are here

function scald_scald_render in Scald: Media Management made easy 7

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

Implements hook_scald_render().

1 call to scald_scald_render()
scald_render in ./scald.module
Render a Scald Atom.

File

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

Code

function scald_scald_render($atom, $context, $options = array()) {
  switch ($context) {
    case 'no-access':
      $output = theme('scald_render_error', array(
        'context' => $context,
        'message' => t('You do not have access to view this Atom.'),
        'atom' => $atom,
      ));
      break;
    case 'invalid-id':
      $output = theme('scald_render_error', array(
        'context' => $context,
        'message' => t('Invalid Scald ID.'),
        'atom' => $atom,
      ));
      break;
    case 'deleted':
      $output = theme('scald_render_error', array(
        'context' => $context,
        'message' => t('Atom deleted!'),
        'atom' => $atom,
      ));
      break;
    default:

      // If this is a custom context created through the UI, we use a special
      // render.
      $system = _scald_system_contexts();
      if ($context == 'full' || empty($system[$context])) {
        $output = scald_atom_view($atom, $context);
      }
      else {
        $output = $atom->rendered->title;
      }
      break;
  }
  return $output;
}