function theme_media_gallery_license in Media Gallery 7.2
Same name and namespace in other branches
- 7 media_gallery.theme.inc \theme_media_gallery_license()
2 theme calls to theme_media_gallery_license()
- theme_media_gallery_media_item_detail in ./
media_gallery.theme.inc - Displays a media item (entity) as its own page, within gallery context.
- theme_media_gallery_media_item_lightbox in ./
media_gallery.theme.inc - Displays a media item (entity) within a lightbox.
File
- ./
media_gallery.theme.inc, line 535 - Media Gallery Theming
Code
function theme_media_gallery_license($variables) {
// Don't display license information for externally hosted media. See
// media_gallery_field_attach_form().
if (isset($variables['file'])) {
// @todo Implement a more generic determination for when a license applies
// and when it doesn't.
if (file_uri_scheme($variables['file']->uri) == 'youtube') {
return '';
}
}
if (isset($variables['element']['#items'][0]['value'])) {
$item = $variables['element']['#items'][0]['value'];
}
else {
$item = 'none';
}
$color = $variables['color'];
$options = explode('_', $item);
// Open a wrapper around the icons.
$output = '<span class="media-license ' . $color . '">';
if (empty($item) || $item === 'none') {
$output .= '<span class="copyright" title="All rights reserved"></span>';
}
$output .= in_array('cc', $options) ? '<span class="attribution" title="Attribution"></span>' : '';
$output .= in_array('nc', $options) ? '<span class="non-commercial" title="Non-Commercial"></span>' : '';
$output .= in_array('sa', $options) ? '<span class="share-alike" title="Share Alike"></span>' : '';
$output .= in_array('nd', $options) ? '<span class="no-deriv" title="No Derivative Works"></span>' : '';
$output .= '</span>';
return $output;
}