function theme_sdl_library_item in Scald: Media Management made easy 7
Same name and namespace in other branches
- 6 scald_dnd_library/scald_dnd_library.module \theme_sdl_library_item()
Returns HTML for an atom rendered in the "Library Item" context.
1 theme call to theme_sdl_library_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 208 - Scald DnD Library
Code
function theme_sdl_library_item($variables) {
$atom = $variables['atom'];
$image = $variables['image'];
$informations = $atom->rendered;
// Action links
$links = scald_atom_user_build_actions_links($atom, NULL);
// Force view link in the dnd library to open in a new window
if (current_path() == dnd_get_library()) {
$links['view']['attributes']['target'] = '_blank';
}
// The Insert link. Use the "_" prefix to avoid collision with possible
// "insert" action.
$links['_insert'] = array(
'title' => t('Insert'),
'external' => TRUE,
'fragment' => FALSE,
'attributes' => array(
'data-atom-id' => $atom->sid,
'style' => 'display:none',
),
'href' => '',
);
$links_element = array(
'#theme' => 'links',
'#links' => $links,
'#attributes' => array(
'class' => array(
'links',
'inline',
),
),
);
$rendered_links = drupal_render($links_element);
// Authors.
if (!empty($informations->authors)) {
foreach ($informations->authors as $author) {
$author_names[] = check_plain($author->name);
}
$authors = implode(', ', $author_names);
}
else {
$authors = '';
}
$return = "<div class='image'>{$image}</div>\n <div class='meta type-" . drupal_html_class($atom->type) . " clearfix'>\n <div class='title'>{$informations->title}</div>\n <div class='author'>{$authors}</div>\n {$rendered_links}\n </div>\n ";
return $return;
}