You are here

function theme_sdl_preview_item in Scald: Media Management made easy 7

Same name and namespace in other branches
  1. 6 scald_dnd_library/scald_dnd_library.module \theme_sdl_preview_item()

Returns HTML for an atom rendered in the "Preview" context.

1 theme call to theme_sdl_preview_item()
scald_dnd_library_scald_render in modules/library/scald_dnd_library/scald_dnd_library.module
Implements hook_scald_render().

File

modules/library/scald_dnd_library/scald_dnd_library.module, line 304
Scald DnD Library

Code

function theme_sdl_preview_item($variables) {
  $atom = $variables['atom'];
  $image = $variables['image'];
  $resource_label = t('Resource');
  $informations_label = t('Informations');
  $resource = theme('sdl_editor_item', array(
    'informations' => $atom->rendered,
    'image' => $image,
  ));
  $title_label = t('Title');
  $title_value = $atom->rendered->title;
  if (!empty($atom->rendered->authors)) {
    $author_label = t('Author');
    foreach ($atom->rendered->authors as $author) {
      $names[] = $author->link;
    }
    $author_name = implode(', ', $names);
    $author = "<dt>{$author_label}</dt><dd>{$author_name}</dd>";
  }
  else {
    $author = "";
  }
  return "\n<div class='sdl-preview-item'>\n  <h3>{$resource_label}</h3>\n    {$resource}\n  <h3>{$informations_label}</h3>\n  <dl>\n    <dt>{$title_label}</dt>\n    <dd>{$title_value}</dd>\n    {$author}\n  </dl>\n</div>\n  ";
}