1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Functions for dealing with CDM entities of type SpeciemenOrOccurrences
|
5
|
*
|
6
|
* @copyright
|
7
|
* (C) 2007-2012 EDIT
|
8
|
* European Distributed Institute of Taxonomy
|
9
|
* http://www.e-taxonomy.eu
|
10
|
*
|
11
|
* The contents of this module are subject to the Mozilla
|
12
|
* Public License Version 1.1.
|
13
|
* @see http://www.mozilla.org/MPL/MPL-1.1.html
|
14
|
*
|
15
|
* @author
|
16
|
* - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
|
17
|
*/
|
18
|
const MEDIA_GALLERY_ID_PREFIX = 'media-gallery-';
|
19
|
|
20
|
/**
|
21
|
* Returns an array of render array entries for a HTML description list.
|
22
|
*
|
23
|
* @see theme_description_list()
|
24
|
*
|
25
|
* @param array $rights_list
|
26
|
* array of CDM Rights entities
|
27
|
*
|
28
|
* @return array
|
29
|
* the render array of the groups for the HTML description list
|
30
|
*/
|
31
|
function cdm_rights_as_dl_groups($rights_list) {
|
32
|
$copyrights = array();
|
33
|
|
34
|
$licenses = array();
|
35
|
$access_rights = array();
|
36
|
$unknown = array();
|
37
|
|
38
|
foreach ($rights_list as $right) {
|
39
|
if (!is_object($right)) {
|
40
|
continue;
|
41
|
}
|
42
|
$type_uuid = isset($right->type->uuid) ? $right->type->uuid : 'UNKNOWN';
|
43
|
switch ($type_uuid) {
|
44
|
|
45
|
case UUID_RIGHTS_COPYRIGHT:
|
46
|
$text = '';
|
47
|
if (isset($right->text) ){
|
48
|
// sanitize potential '(c)' away
|
49
|
$text = preg_replace('/^\(c\)/', '', $right->text);
|
50
|
} if (isset($right->agent) ){
|
51
|
$text .= (strlen($text) > 0 ? ', ' : '') . $right->agent->titleCache;
|
52
|
}
|
53
|
|
54
|
$copyrights[] = array('#markup' => '© ' . $text);
|
55
|
break;
|
56
|
|
57
|
case UUID_RIGHTS_LICENCE:
|
58
|
$license_str = '';
|
59
|
if (isset($right->abbreviatedText)) {
|
60
|
$license_str .= $right->abbreviatedText;
|
61
|
}
|
62
|
if (isset($right->uri)) {
|
63
|
if (strlen($license_str) > 0) {
|
64
|
$license_str = l($license_str, $right->uri);
|
65
|
}
|
66
|
else {
|
67
|
$license_str = l(t('link'), $right->uri);
|
68
|
}
|
69
|
}
|
70
|
if (strlen($license_str) > 0 && isset($right->text)) {
|
71
|
$license_str .= ': ' . $right->text;
|
72
|
}
|
73
|
$licenses[] = array('#markup' => $license_str);
|
74
|
break;
|
75
|
|
76
|
case UUID_RIGHTS_ACCESS_RIGHTS:
|
77
|
$access_rights[] = array('#markup' => $right->text);
|
78
|
break;
|
79
|
|
80
|
default:
|
81
|
$unknown_groups[] = array('#markup' => $right->text);
|
82
|
}
|
83
|
}
|
84
|
|
85
|
$groups = array();
|
86
|
if (count($copyrights) > 0) {
|
87
|
_description_list_group_add($groups, t('Copyright') . ':', $copyrights);
|
88
|
}
|
89
|
if (count($licenses) > 0) {
|
90
|
_description_list_group_add($groups, t('Licenses') . ':', $licenses);
|
91
|
}
|
92
|
if (count($access_rights) > 0) {
|
93
|
_description_list_group_add($groups, t('Access rights') . ':', $access_rights);
|
94
|
}
|
95
|
if (count($unknown) > 0) {
|
96
|
_description_list_group_add($groups, t('Rights') . ':', $unknown);
|
97
|
}
|
98
|
|
99
|
return $groups;
|
100
|
|
101
|
}
|
102
|
|
103
|
|
104
|
/**
|
105
|
* Provides the markup for an icon to represent a media which is associated with the given $feature.
|
106
|
*
|
107
|
* @param $feature
|
108
|
* the cdm Feature term
|
109
|
* @param $media_url
|
110
|
* Optional, currently unused. May be used in future to display different
|
111
|
* icons for different media urls, like the fav-icon of the referenced
|
112
|
* @return string
|
113
|
* The markup for the icon
|
114
|
*/
|
115
|
function media_feature_icon($feature, $media_url = NULL) {
|
116
|
return font_awesome_icon_markup('fa-book', array('alt' => $feature->representation_L10n));
|
117
|
}
|
118
|
|
119
|
/**
|
120
|
* Gets the metadata info such as title or artist and source references of a media file.
|
121
|
*
|
122
|
* The function tries at first to get all the info from the file metadata
|
123
|
* and if it is not available look at the media file info stored at the database.
|
124
|
*
|
125
|
* @param mixed $media
|
126
|
* The media file object for which to get the metadata.
|
127
|
*
|
128
|
* @return array
|
129
|
* The array with the available specified metadata info.
|
130
|
*/
|
131
|
function read_media_metadata($media)
|
132
|
{
|
133
|
|
134
|
$metadata = array(
|
135
|
'title' => '',// Media_metadata and media.
|
136
|
'artist' => '',// Media_metadata and media.
|
137
|
'rights',// Media_metadata and media.
|
138
|
'location',// Media_metadata.
|
139
|
'filename' => '',// Media.
|
140
|
'mediacreated' => '', // Media.
|
141
|
'description' => ''
|
142
|
);
|
143
|
|
144
|
// Getting the media metadata.
|
145
|
$media_metadata = cdm_ws_get(CDM_WS_MEDIA_METADATA, array($media->uuid));
|
146
|
$media_metadata_aux = (array)$media_metadata;
|
147
|
|
148
|
|
149
|
// Filename.
|
150
|
if (!empty($media->representations[0]->parts[0]->uri)) {
|
151
|
$fileUri = $media->representations[0]->parts[0]->uri;
|
152
|
$filename = substr($fileUri, strrpos($fileUri, "/") + 1);
|
153
|
$metadata['filename'] = $filename;
|
154
|
} else {
|
155
|
$metadata['filename'] = '';
|
156
|
}
|
157
|
|
158
|
// Title.
|
159
|
if (!empty($media->title_L10n)) {
|
160
|
$metadata['title'] = $media->title_L10n;
|
161
|
} else if ($media->protectedTitleCache && !empty($media->titleCache)) {
|
162
|
$metadata['title'] = $media->titleCache;
|
163
|
} else if (!empty($media_metadata->ObjectName)) {
|
164
|
$metadata['title'] = $media_metadata->ObjectName;
|
165
|
} else if (!empty($media_metadata_aux['Object Name'])) {
|
166
|
$metadata['title'] = $media_metadata_aux['Object Name'];
|
167
|
} else if (!empty($media->titleCache)) {
|
168
|
$metadata['title'] = $media->titleCache;
|
169
|
}
|
170
|
|
171
|
if (!empty($media->description_L10n)) {
|
172
|
$metadata['description'] = $media->description_L10n;
|
173
|
}
|
174
|
|
175
|
// Artist.
|
176
|
if (!empty($media->artist->titleCache)) {
|
177
|
$metadata['artist'] = $media->artist->titleCache;
|
178
|
} else if (!empty($media_metadata->Artist)) {
|
179
|
$metadata['artist'] = '' . $media_metadata->Artist;
|
180
|
}
|
181
|
|
182
|
// Rights
|
183
|
$metadata['rights'] = array();
|
184
|
if (!empty($media_metadata->Copyright)) {
|
185
|
$rightsObj = new stdClass();
|
186
|
$rightsObj->type = new stdClass();
|
187
|
$rightsObj->type->uuid = UUID_RIGHTS_COPYRIGHT;
|
188
|
$rightsObj->type->titleCache = 'copyright';
|
189
|
$rightsObj->type->representation_L10n = 'copyright';
|
190
|
$rightsObj->type->text = $media_metadata->Copyright;
|
191
|
$metadata['rights'][] = $rightsObj;
|
192
|
}
|
193
|
if (isset($media->rights) && is_array($media->rights)) {
|
194
|
$metadata['rights'] = array_merge($metadata['rights'], $media->rights);
|
195
|
}
|
196
|
|
197
|
// Filling the description (though there is no description in the db???).
|
198
|
// $metadata_caption['description'] = $media->description_L10n;
|
199
|
|
200
|
// Location.
|
201
|
$metadata['location'] = array();
|
202
|
$metadata['location']['sublocation'] = !empty($media_metadata->Sublocation) ? $media_metadata->Sublocation : FALSE;
|
203
|
$metadata['location']['city'] = !empty($media_metadata->City) ? $media_metadata->City : FALSE;
|
204
|
$metadata['location']['province'] = !empty($media_metadata->Province) ? $media_metadata->Province : FALSE;
|
205
|
$metadata['location']['country'] = !empty($media_metadata->Country) ? $media_metadata->Country : FALSE;
|
206
|
|
207
|
/*
|
208
|
// Creation date.
|
209
|
if($media_metadata["Modify Date"])
|
210
|
$metadata['mediacreated'] = $media_metadata["Modify Date"];
|
211
|
else
|
212
|
*/
|
213
|
if (!empty($media->mediaCreated)) {
|
214
|
$metadata['mediacreated'] = timePeriodToString($media->mediaCreated);
|
215
|
}
|
216
|
|
217
|
return $metadata;
|
218
|
}
|
219
|
|
220
|
|
221
|
/**
|
222
|
* Return HTML for a media gallery
|
223
|
*
|
224
|
* @param array $configuration
|
225
|
* An associative array containing:
|
226
|
* - mediaList: An array of Media entities.
|
227
|
* - maxExtend
|
228
|
* - cols
|
229
|
* - maxRows
|
230
|
* - showCaption: boolean value, whether to show captions or not.
|
231
|
* - captionElements: An array of caption elements to be shown. In case the array
|
232
|
* is empty of NULL all available caption elements will be show. In order to
|
233
|
* supress all captions set 'showCaption' to FALSE
|
234
|
* example:
|
235
|
* 1) Show 'title', 'description', 'file', 'filename' in the caption:
|
236
|
* array('title', 'description', 'file', 'filename'),
|
237
|
* 2) To add an addtional link at the bottom of the caption:
|
238
|
* array('titlecache', '#uri'=>t('Open Image')) this will cause a link
|
239
|
* to be rendered with label 'Open image' which will open the according
|
240
|
* media object.
|
241
|
* - mediaLinkType: Valid values:
|
242
|
* - "NONE": do not link the images,
|
243
|
* - "LIGHTBOX": open the link in a light box,
|
244
|
* - "NORMAL": link to the image page or to the $alternativeMediaUri if
|
245
|
* it is defined.
|
246
|
* - alternativeMediaUri: A fix string or an array of alternative URIs to link the images
|
247
|
* which will overwrite the URIs of the media parts.
|
248
|
* The order of URI in this array must correspond with the order of
|
249
|
* images in $mediaList.
|
250
|
* - galleryLinkUri: An URI to link the the hint on more images to;
|
251
|
* if NULL no link is created.
|
252
|
*
|
253
|
* @return array
|
254
|
* A render array for the image gallery
|
255
|
* @ingroup: compose
|
256
|
*/
|
257
|
function compose_cdm_media_gallery($configuration) {
|
258
|
|
259
|
$mediaList = $configuration['mediaList'];
|
260
|
|
261
|
// Do not show an empty gallery.
|
262
|
if (!is_array($mediaList) || count($mediaList) == 0){
|
263
|
return '';
|
264
|
}
|
265
|
|
266
|
|
267
|
// merge with default
|
268
|
$configuration = array_merge(
|
269
|
array(
|
270
|
'mediaList' => NULL,
|
271
|
'galleryName' => NULL,
|
272
|
'max_extend' => 150,
|
273
|
'cols' => 4,
|
274
|
'maxRows' => FALSE,
|
275
|
'captionElements' => array('title'),
|
276
|
'mediaLinkType' => 'LIGHTBOX',
|
277
|
'alternative_media_uri' => NULL,
|
278
|
'galleryLinkUri' => NULL,
|
279
|
'showCaption' => TRUE,
|
280
|
),
|
281
|
$configuration);
|
282
|
|
283
|
$image_mime_type_list = [
|
284
|
'image/jpg',
|
285
|
'image/jpeg',
|
286
|
'image/png',
|
287
|
'image/gif',
|
288
|
];
|
289
|
|
290
|
$galleryName = $configuration['galleryName'];
|
291
|
$max_extend = $configuration['max_extend'];
|
292
|
$cols = $configuration['cols'];
|
293
|
$maxRows = $configuration['maxRows'];
|
294
|
$captionElements = $configuration['captionElements'];
|
295
|
$mediaLinkType = $configuration['mediaLinkType'];
|
296
|
$alternative_media_uri = $configuration['alternative_media_uri'];
|
297
|
$galleryLinkUri = $configuration['galleryLinkUri'];
|
298
|
$showCaption = $configuration['showCaption'];
|
299
|
|
300
|
$do_link_to_media = '';
|
301
|
if(isset($captionElements['#uri'])){
|
302
|
$do_link_to_media = $captionElements['#uri'];
|
303
|
unset($captionElements['#uri']);
|
304
|
}
|
305
|
if (!is_array($captionElements) || count($captionElements) == 0) {
|
306
|
$captionElements = NULL;
|
307
|
}
|
308
|
|
309
|
// TODO correctly handle multiple media representation parts
|
310
|
$_SESSION['cdm']['last_gallery'] = current_path();
|
311
|
// Prevent from errors.
|
312
|
//if (!isset($mediaList[0])) {
|
313
|
// return;
|
314
|
//}
|
315
|
|
316
|
// --- Duplicate suppression: media can be reused but should only be shown
|
317
|
// once.
|
318
|
$tempMediaList = array();
|
319
|
$tempMediaUuids = array();
|
320
|
foreach ($mediaList as $media) {
|
321
|
if (!in_array($media->uuid, $tempMediaUuids)) {
|
322
|
$tempMediaList[] = $media;
|
323
|
$tempMediaUuids[] = $media->uuid;
|
324
|
}
|
325
|
}
|
326
|
$mediaList = $tempMediaList;
|
327
|
|
328
|
// ---
|
329
|
$galleryID = "media_gallery_" . $galleryName;
|
330
|
|
331
|
$mediaPartLinkAttributes = array();
|
332
|
$openMediaLinkAttributes = array();
|
333
|
|
334
|
// Prepare media links.
|
335
|
$doLink = FALSE;
|
336
|
if ($mediaLinkType != 'NONE') {
|
337
|
$doLink = TRUE;
|
338
|
}
|
339
|
if ($mediaLinkType == 'LIGHTBOX') {
|
340
|
$doLink = TRUE;
|
341
|
_add_js_lightbox($galleryID);
|
342
|
}
|
343
|
|
344
|
// Render the media gallery grid.
|
345
|
$out = '<table id="' . $galleryID . '" class="media_gallery">';
|
346
|
$out .= '<colgroup>';
|
347
|
for ($c = 0; $c < $cols; $c++) {
|
348
|
$out .= '<col style="width:' . (100 / $cols) . '%;">';
|
349
|
}
|
350
|
$out .= '</colgroup>';
|
351
|
|
352
|
for ($r = 0; ($r < $maxRows || !$maxRows) && count($mediaList) > 0; $r++) {
|
353
|
$captionParts = array();
|
354
|
$mediaIndex = 0;
|
355
|
$out .= '<tr class="media-row">';
|
356
|
for ($c = 0; $c < $cols; $c++) {
|
357
|
$media = array_shift($mediaList);
|
358
|
if(!$media){
|
359
|
continue;
|
360
|
}
|
361
|
$complete_media = cdm_ws_get(CDM_WS_MEDIA, $media->uuid);
|
362
|
if (isset($complete_media->representations[0]->parts[0])) {
|
363
|
|
364
|
$gallery_media_item = new GalleryItemMedia($complete_media, $max_extend, $max_extend);
|
365
|
|
366
|
// if($gallery_media_item->hasWebAppItem()) {
|
367
|
// $media_part_markup = cdm_media_gallerie_entry_webapp($gallery_media_item, $max_extend, TRUE);
|
368
|
// } else {
|
369
|
$thumbnail_item = $gallery_media_item->getThumbnailImageMediaItem();
|
370
|
$media_part_markup = cdm_media_gallery_entry_image($thumbnail_item, $max_extend, TRUE);
|
371
|
// }
|
372
|
|
373
|
// --- Compose Media Link.
|
374
|
$media_link_uri = FALSE;
|
375
|
if ($alternative_media_uri) {
|
376
|
if (isset($alternative_media_uri[$mediaIndex])) {
|
377
|
$media_link_uri = $alternative_media_uri[$mediaIndex];
|
378
|
}
|
379
|
if (is_string($alternative_media_uri)) {
|
380
|
$media_link_uri = $alternative_media_uri;
|
381
|
}
|
382
|
} else {
|
383
|
$media_link_uri = $gallery_media_item->getOpenItemUrl();
|
384
|
}
|
385
|
$mediaIndex++;
|
386
|
|
387
|
// media captions will be loaded via AHAH
|
388
|
_add_js_ahah();
|
389
|
$content_url = cdm_compose_ws_url(CDM_WS_PORTAL_MEDIA, $media->uuid);
|
390
|
//if $captionElements == null, set $caption_part_markup = '' otherwise the loading image is shown but nothing is loaded.
|
391
|
if ($captionElements) {
|
392
|
$cdm_proxy_url_caption = url('cdm_api/proxy/' . urlencode($content_url) . "/cdm_media_caption/" . serialize($captionElements));
|
393
|
$ahah_media_caption = '<div class="ahah-content" data-cdm-ahah-url="' . $cdm_proxy_url_caption . '">'
|
394
|
. '<span class="loading" style="display: none;">' . loading_image_html() . '</span></div>';
|
395
|
|
396
|
// preparing the part link (= click on image itself) which can be handled in two ways
|
397
|
//
|
398
|
// 1. open image in lightbox, the captions in the lightbox will be loaded via AHAH
|
399
|
// 2. open the media in a new window with target 'specimen'
|
400
|
if ($mediaLinkType == 'LIGHTBOX' && $gallery_media_item->hasFullSizeImage()) {
|
401
|
$mediaPartLinkAttributes['class'] = array('lightbox');
|
402
|
} else {
|
403
|
$mediaPartLinkAttributes['target'] = "specimen";
|
404
|
$openMediaLinkAttributes['target'] = "specimen";
|
405
|
}
|
406
|
$mediaPartLinkAttributes['alt'] = htmlentities($ahah_media_caption);
|
407
|
|
408
|
// --- preparing the media caption
|
409
|
|
410
|
/* old comment: "no caption elements to show up here except the $caption_link_uri, if at all"
|
411
|
*
|
412
|
* a.kohlbecker 2013-03-14 :
|
413
|
* It is unclear why no caption elements should be shown, Was it a technical reason?
|
414
|
* see commit r16723 740177eb-a1d8-4ec3-a630-accd905eb3da
|
415
|
* If not problems arise with this remove it after some weeks
|
416
|
*/
|
417
|
$caption_part_markup = $ahah_media_caption;
|
418
|
}else{
|
419
|
// no caption_elements --> empty caption
|
420
|
$caption_part_markup = '';
|
421
|
}
|
422
|
if ($do_link_to_media) {
|
423
|
if ($gallery_media_item->hasFullSizeImage()) {
|
424
|
// it is an image, so open it in the media page
|
425
|
$caption_part_markup .= '<div class="media-caption-link">' . l("Open in viewer " . custom_icon_font_markup('icon-interal-link-alt-solid'), path_to_media($media->uuid), array(
|
426
|
'attributes' => array(), 'html' => TRUE,
|
427
|
)) . '</div>';
|
428
|
}
|
429
|
if ($gallery_media_item->hasWebAppItem()) {
|
430
|
// otherwise open it directly and let the the browser handle the media type
|
431
|
$openMediaLinkAttributes['absolute'] = TRUE;
|
432
|
$caption_part_markup .= '<div class="media-caption-link">' . l("Open external page " . font_awesome_icon_markup('fa-external-link-alt', array('class' => array('superscript'))), $gallery_media_item->getWebAppUrl(), array(
|
433
|
'attributes' => $openMediaLinkAttributes, 'html' => TRUE,
|
434
|
)) . '</div>';
|
435
|
}
|
436
|
}
|
437
|
|
438
|
$captionParts[] = $caption_part_markup;
|
439
|
|
440
|
// --- Surround imagePart with link, this .
|
441
|
if ($doLink) {
|
442
|
$media_part_markup = l($media_part_markup, $gallery_media_item->getOverlayImageUrl(), array(
|
443
|
'attributes' => $mediaPartLinkAttributes, 'html' => TRUE,
|
444
|
));
|
445
|
}
|
446
|
} else {
|
447
|
$media_part_markup = '';
|
448
|
$captionParts[] = '';
|
449
|
}
|
450
|
$out .= '<td class="media">' . $media_part_markup . '</td>';
|
451
|
}
|
452
|
$out .= '</tr>'; // End of media parts.
|
453
|
if ($showCaption) {
|
454
|
if ( (is_array($captionElements) && count($captionElements) > 0) || $do_link_to_media) {
|
455
|
$out .= '<tr class="caption-row">';
|
456
|
// Add caption row.
|
457
|
foreach ($captionParts as $caption_part_markup) {
|
458
|
$out .= '<td class="caption">' . $caption_part_markup . '</td>';
|
459
|
}
|
460
|
$out .= '</tr>';
|
461
|
}
|
462
|
}
|
463
|
}
|
464
|
|
465
|
if ($galleryLinkUri) {
|
466
|
if (count($mediaList) > 0) {
|
467
|
$moreHtml = count($mediaList) . ' ' . t('more in gallery');
|
468
|
}
|
469
|
else {
|
470
|
$moreHtml = t('open gallery');
|
471
|
}
|
472
|
$moreHtml = l($moreHtml, $galleryLinkUri);
|
473
|
$out .= '<tr class="more-items-row"><td colspan="' . $cols . '">' . $moreHtml . '</td></tr>';
|
474
|
}
|
475
|
$out .= '</table>';
|
476
|
|
477
|
return $out;
|
478
|
}
|
479
|
|
480
|
/**
|
481
|
* Creates markup for a CDM MediaRepresentation which is referencing an image.
|
482
|
*
|
483
|
* @param \ImageMediaItem $thumbnailImage
|
484
|
* @param $maxExtend
|
485
|
* @param $addPassePartout
|
486
|
* @param $attributes
|
487
|
* An array of attributes for the img tag.
|
488
|
*
|
489
|
* @return string
|
490
|
* The markup for the media representation
|
491
|
*/
|
492
|
function cdm_media_gallery_entry_image($thumbnailImage, $maxExtend, $addPassePartout, $attributes = array()) {
|
493
|
|
494
|
$out = '';
|
495
|
|
496
|
// TODO merge with theme_cdm_media_mime_image?
|
497
|
if (isset($thumbnailImage)) {
|
498
|
|
499
|
$size = $thumbnailImage->getSize();
|
500
|
$h = @$size->height;
|
501
|
$w = @$size->width;
|
502
|
$thumbnail_image_uri = $thumbnailImage->getUrl();
|
503
|
if (!($w && $h)) {
|
504
|
// Take url and replace spaces.
|
505
|
// TODO this should go into the ImageMediaItem
|
506
|
$imageDimensions = getimagesize_remote(str_replace(' ', '%20', $thumbnail_image_uri));
|
507
|
if (!$imageDimensions) {
|
508
|
return '<div>' . t('Image unavailable, uri: ') . $thumbnail_image_uri . '</div>';
|
509
|
}
|
510
|
$w = $imageDimensions[0];
|
511
|
$h = $imageDimensions[1];
|
512
|
}
|
513
|
|
514
|
$ratio = $w / $h;
|
515
|
if ($ratio > 1) {
|
516
|
$displayHeight = round($maxExtend / $ratio);
|
517
|
$displayWidth = $maxExtend;
|
518
|
$m = round(($maxExtend - $displayHeight) / 2);
|
519
|
$margins = 'margin:' . $m . 'px 0 ' . $m . 'px 0;';
|
520
|
}
|
521
|
else {
|
522
|
$displayHeight = $maxExtend;
|
523
|
$displayWidth = round($maxExtend * $ratio);
|
524
|
$m = round(($maxExtend - $displayWidth) / 2);
|
525
|
$margins = 'margin:0 ' . $m . 'px 0 ' . $m . 'px;';
|
526
|
}
|
527
|
|
528
|
// Turn attributes array into string.
|
529
|
if(!is_array($attributes)){
|
530
|
$attributes = array();
|
531
|
}
|
532
|
if(!isset($attributes['alt'])){
|
533
|
$attributes['alt'] = check_plain($thumbnail_image_uri);
|
534
|
}
|
535
|
$attrStr = ' ';
|
536
|
// $attributes['title'] = 'h:'.$h.', w:'.$w.',ratio:'.$ratio;
|
537
|
if (is_array($attributes)) {
|
538
|
foreach ($attributes as $name => $value) {
|
539
|
$attrStr .= $name . '="' . $value . '" ';
|
540
|
}
|
541
|
}
|
542
|
|
543
|
if ($addPassePartout) {
|
544
|
$out .= '<div class="image-passe-partout" style="width:' . $maxExtend . 'px; height:' . $maxExtend . 'px;">';
|
545
|
} else {
|
546
|
// Do not add margins if no pass-partout is shown.
|
547
|
$margins = '';
|
548
|
}
|
549
|
$out .= '<img src="' . $thumbnail_image_uri . '" width="' . $displayWidth . '" height="' . $displayHeight . '" style="' . $margins . '"' . $attrStr . ' />';
|
550
|
if ($addPassePartout) {
|
551
|
$out .= '</div>';
|
552
|
}
|
553
|
}
|
554
|
|
555
|
return $out;
|
556
|
}
|
557
|
|
558
|
/**
|
559
|
* Creates markup for a CDM MediaRepresentation which is referencing an web application.
|
560
|
*
|
561
|
* @param ImageMediaItem $galleryItemMedia
|
562
|
* @param $maxExtend
|
563
|
* @param $addPassePartout
|
564
|
* @param $attributes
|
565
|
*
|
566
|
* @return string
|
567
|
* The markup for the media representation
|
568
|
*/
|
569
|
function cdm_media_gallerie_entry_webapp($galleryItemMedia, $maxExtend, $addPassePartout, $attributes = array()) {
|
570
|
|
571
|
$out = '';
|
572
|
|
573
|
if (isset($galleryItemMedia)) {
|
574
|
$out = '<div class="application"><image src="' . $galleryItemMedia->getUrl() . '"></div>';
|
575
|
if ($addPassePartout) {
|
576
|
$out .= '<div class="image-passe-partout" style="width:' . $maxExtend . 'px; height:' . $maxExtend . 'px;">' . $out .'</div>';
|
577
|
}
|
578
|
}
|
579
|
|
580
|
return $out;
|
581
|
}
|
582
|
|
583
|
/**
|
584
|
* Adds the OpenLayers based image viewer to the page.
|
585
|
*
|
586
|
* The OpenLayers based image viewer allows to zoom and pan the displayed image.
|
587
|
*
|
588
|
* Documentation related to using Openlayers in order to view images is found here:
|
589
|
* - @see http://trac.openlayers.org/wiki/UsingCustomTiles#UsingTilesWithoutaProjection
|
590
|
* - @see http://trac.openlayers.org/wiki/SettingZoomLevels
|
591
|
*
|
592
|
* @param array $variables
|
593
|
* An associative array of theme variables:
|
594
|
* - mediaRepresentationPart: The CDM MediaRepresentationPart instance to be displayed.
|
595
|
* - maxExtend: The maximum extend of the image viewer view port.
|
596
|
*/
|
597
|
function cdm_openlayers_image($mediaRepresentationPart, $maxExtend) {
|
598
|
|
599
|
_add_js_openlayers();
|
600
|
|
601
|
// TODO merge code below with code from theme_cdm_media_gallerie_image
|
602
|
// var_dump("MEDIA URI: " . $mediaRepresentationPart->uri);
|
603
|
// TODO merge code below with code from theme_cdm_media_gallerie_image
|
604
|
$w = @$mediaRepresentationPart->width;
|
605
|
$h = @$mediaRepresentationPart->height;
|
606
|
|
607
|
if (!($w && $h)) {
|
608
|
// Take url and replace spaces.
|
609
|
$image_uri = str_replace(' ', '%20', $mediaRepresentationPart->uri);
|
610
|
$imageDimensions = getimagesize_remote($image_uri);
|
611
|
if (!$imageDimensions) {
|
612
|
return '<div>' . t('Image unavailable, uri:') . $mediaRepresentationPart->uri . '</div>';
|
613
|
}
|
614
|
$w = $imageDimensions[0];
|
615
|
$h = $imageDimensions[1];
|
616
|
}
|
617
|
|
618
|
// Calculate maxResolution
|
619
|
if ($w > $h) {
|
620
|
$maxRes = $w / $maxExtend;
|
621
|
}
|
622
|
else {
|
623
|
$maxRes = $h / $maxExtend;
|
624
|
}
|
625
|
|
626
|
$maxRes *= 1;
|
627
|
|
628
|
drupal_add_js('
|
629
|
var map;
|
630
|
|
631
|
var imageLayerOptions={
|
632
|
maxResolution: ' . $maxRes . ',
|
633
|
maxExtent: new OpenLayers.Bounds(0, 0, ' . $w . ', ' . $h . ')
|
634
|
};
|
635
|
var mapOptions={
|
636
|
controls:
|
637
|
[
|
638
|
new OpenLayers.Control.PanZoom(),
|
639
|
new OpenLayers.Control.Navigation({zoomWheelEnabled: false, handleRightClicks:true, zoomBoxKeyMask: OpenLayers.Handler.MOD_CTRL})
|
640
|
],
|
641
|
restrictedExtent: new OpenLayers.Bounds(0, 0, ' . $w . ', ' . $h . ')
|
642
|
};
|
643
|
|
644
|
var graphic = new OpenLayers.Layer.Image(
|
645
|
\'Image Title\',
|
646
|
\'' . $mediaRepresentationPart->uri . '\',
|
647
|
new OpenLayers.Bounds(0, 0, ' . $w . ', ' . $h . '),
|
648
|
new OpenLayers.Size(' . $w . ', ' . $h . '),
|
649
|
imageLayerOptions
|
650
|
);
|
651
|
|
652
|
function init() {
|
653
|
map = new OpenLayers.Map(\'openlayers_image\', mapOptions);
|
654
|
map.addLayers([graphic]);
|
655
|
map.setCenter(new OpenLayers.LonLat(0, 0), 1);
|
656
|
map.zoomToMaxExtent();
|
657
|
}
|
658
|
|
659
|
jQuery(document).ready(function(){
|
660
|
init();
|
661
|
});', array('type' => 'inline'));
|
662
|
$out = '<div id="openlayers_image" class="image_viewer" style="width: ' . $maxExtend . 'px; height:' . ($maxExtend) . 'px"></div>';
|
663
|
return $out;
|
664
|
}
|
665
|
|
666
|
|
667
|
/**
|
668
|
* @param $taxon
|
669
|
* @param $gallery_viewer
|
670
|
* @param $media
|
671
|
*
|
672
|
* @return string
|
673
|
*/
|
674
|
function render_taxon_media_gallery($taxon, $gallery_viewer, $media) {
|
675
|
$media_gallery = '<div id="' . MEDIA_GALLERY_ID_PREFIX . $gallery_viewer . '">' .
|
676
|
call_user_func_array('taxon_media_gallery_' . $gallery_viewer, [
|
677
|
$taxon,
|
678
|
$media,
|
679
|
])
|
680
|
. '</div>';
|
681
|
return $media_gallery;
|
682
|
}
|
683
|
|
684
|
/**
|
685
|
* Implementation of Hook taxon_image_gallery() using the static image gallery
|
686
|
* based on OpenLayers..
|
687
|
*
|
688
|
* @param object $taxon
|
689
|
* @param object $media
|
690
|
*
|
691
|
* @return string
|
692
|
* Markup for the static viewer media gallery
|
693
|
*
|
694
|
* @throws Exception
|
695
|
*/
|
696
|
function taxon_media_gallery_default($taxon, $media) {
|
697
|
$hasImages = isset($media[0]);
|
698
|
|
699
|
if ($hasImages) {
|
700
|
|
701
|
$maxExtend = 150;
|
702
|
$cols = 3;
|
703
|
$maxRows = FALSE;
|
704
|
$alternativeMediaUri = NULL;
|
705
|
/* Comment @WA: was in D5:
|
706
|
$captionElements = array(
|
707
|
'title',
|
708
|
'rights',
|
709
|
'#uri' => t('Open Image'),
|
710
|
);
|
711
|
*/
|
712
|
$captionElements = array(
|
713
|
'title',
|
714
|
'description',
|
715
|
'artist',
|
716
|
'location',
|
717
|
'rights',
|
718
|
'#uri' => t('Open image'),
|
719
|
);
|
720
|
$gallery_name = $taxon->uuid;
|
721
|
$mediaLinkType = 'LIGHTBOX';
|
722
|
|
723
|
// $gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
|
724
|
|
725
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB);
|
726
|
|
727
|
$out = '<div class="image-gallerie">';
|
728
|
$out .= compose_cdm_media_gallery(array(
|
729
|
'mediaList' => $media,
|
730
|
'galleryName' => $gallery_name,
|
731
|
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
|
732
|
'cols' => $gallery_settings['cdm_dataportal_media_cols'],
|
733
|
'maxRows' => 0, // Ignore maxrows settings.
|
734
|
'captionElements' => $captionElements,
|
735
|
'mediaLinkType' => $mediaLinkType,
|
736
|
'alternativeMediaUri' => NULL,
|
737
|
'galleryLinkUri' => NULL,
|
738
|
'showCaption' => $gallery_settings['cdm_dataportal_show_thumbnail_captions'],
|
739
|
));
|
740
|
$out .= '</div>';
|
741
|
}
|
742
|
else {
|
743
|
$out = 'No images available.';
|
744
|
}
|
745
|
return $out;
|
746
|
}
|
747
|
|
748
|
/**
|
749
|
* Implementation of Hook taxon_image_gallery() which uses the proprietary FSI viewer.
|
750
|
*
|
751
|
* @param object $taxon
|
752
|
* @param object $media
|
753
|
*
|
754
|
* @return string
|
755
|
* Markup for the FSI viewer media gallery
|
756
|
*
|
757
|
* @throws Exception
|
758
|
*/
|
759
|
function taxon_media_gallery_fsi($taxon, $media) {
|
760
|
$flashLink = isset($media[0]);
|
761
|
|
762
|
if ($flashLink) {
|
763
|
|
764
|
if (module_exists("fsi_gallery")) {
|
765
|
$out = render_fsi_gallery($taxon, $media);
|
766
|
}
|
767
|
else {
|
768
|
$message = t('In order to use the FSI gallery you must enable the according ') . l(t("module"), "admin/modules");
|
769
|
drupal_set_message($message, "error");
|
770
|
$out = '<h3>' . $message . '</h3>';
|
771
|
}
|
772
|
}
|
773
|
else {
|
774
|
$out = 'No images available.';
|
775
|
}
|
776
|
return $out;
|
777
|
}
|
778
|
|
779
|
|
780
|
/**
|
781
|
* Implementation of Hook taxon_image_gallery() which uses the Universalviewer
|
782
|
*
|
783
|
* @param object $taxon
|
784
|
* @param object $media
|
785
|
*
|
786
|
* @return string
|
787
|
* Markup for the Universalviewer media gallery
|
788
|
*
|
789
|
* @throws Exception
|
790
|
*/
|
791
|
function taxon_media_gallery_universalviewer($taxon, $media) {
|
792
|
|
793
|
$media_query_parameters = taxon_media_query_parameters();
|
794
|
$manifest_uri = cdm_compose_ws_url(
|
795
|
CDM_WS_IIIF_TAXON_MANIFEST,
|
796
|
array($taxon->uuid),
|
797
|
queryString($media_query_parameters)
|
798
|
);
|
799
|
_add_js_universalviewer('#uv', $manifest_uri);
|
800
|
$out = '<div id="uv" class="uv" style="width: 680px; height: 680px;"></div>';
|
801
|
|
802
|
if(variable_get(CDM_ADDITIONAL_MEDIA_COPYRIGHT, NULL)){
|
803
|
$out .= '<div class="additional_media_copyright">' . variable_get(CDM_ADDITIONAL_MEDIA_COPYRIGHT, NULL) . '</div>';
|
804
|
}
|
805
|
return $out;
|
806
|
}
|
807
|
|
808
|
/**
|
809
|
* Prepares from the settings an array of query parameters for the taxon media webservices:
|
810
|
*
|
811
|
* - CDM_WS_PORTAL_TAXON_SUBTREE_MEDIA
|
812
|
* - CDM_WS_PORTAL_TAXON_MEDIA
|
813
|
* - CDM_WS_IIIF_TAXON_MANIFEST
|
814
|
*
|
815
|
* @return array
|
816
|
*/
|
817
|
function taxon_media_query_parameters() {
|
818
|
$mediaQueryParameters = [
|
819
|
"type" => "ImageFile",
|
820
|
];
|
821
|
$relationship_choice = variable_get(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS, unserialize(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT));
|
822
|
$mediaQueryParameters['relationships'] = implode(',', get_selection($relationship_choice['direct']));
|
823
|
$mediaQueryParameters['relationshipsInvers'] = implode(',', get_selection($relationship_choice['invers']));
|
824
|
|
825
|
$taxon_media_filter_choice = variable_get(CDM_TAXON_MEDIA_FILTER, unserialize(CDM_TAXON_MEDIA_FILTER_DEFAULT));
|
826
|
$mediaQueryParameters['includeTaxonDescriptions'] = (boolean) $taxon_media_filter_choice['includeTaxonDescriptions'] != 0;
|
827
|
$mediaQueryParameters['includeOccurrences'] = (boolean) $taxon_media_filter_choice['includeOccurrences'] != 0;
|
828
|
$mediaQueryParameters['includeOriginals'] = (boolean) $taxon_media_filter_choice['includeOriginals'] != 0;
|
829
|
$mediaQueryParameters['includeTaxonNameDescriptions'] = (boolean) $taxon_media_filter_choice['includeTaxonNameDescriptions'] != 0;
|
830
|
$mediaQueryParameters['includeTaxonomicChildren'] = variable_get('cdm_images_include_children', 0) != 0;
|
831
|
return $mediaQueryParameters;
|
832
|
}
|
833
|
|
834
|
/**
|
835
|
* Extracts the content type directory from the mime type of the passed
|
836
|
* CDM MediaRepresentation.
|
837
|
*/
|
838
|
function media_content_type_dir($media_representation, $default = FALSE) {
|
839
|
if (isset_not_empty($media_representation->mimeType)) {
|
840
|
$ctd = substr($media_representation->mimeType, 0, stripos($media_representation->mimeType, '/'));
|
841
|
return $ctd;
|
842
|
} else {
|
843
|
return $default;
|
844
|
}
|
845
|
}
|
846
|
|
847
|
/**
|
848
|
* @todo Please document this function.
|
849
|
* @see http://drupal.org/node/1354
|
850
|
*/
|
851
|
function getimagesize_remote($image_url) {
|
852
|
$response = cdm_http_request($image_url);
|
853
|
$contents = NULL;
|
854
|
if (isset($response->data)) {
|
855
|
$contents = $response->data;
|
856
|
} else {
|
857
|
return FALSE;
|
858
|
}
|
859
|
|
860
|
$last_level = error_reporting (E_ERROR); // suppress warnings from the imagecreatefromstring() method,
|
861
|
$im = imagecreatefromstring($contents);
|
862
|
error_reporting($last_level); // reset the error_reporting level
|
863
|
|
864
|
if (!$im) {
|
865
|
return FALSE;
|
866
|
}
|
867
|
$gis[0] = ImageSX($im);
|
868
|
$gis[1] = ImageSY($im);
|
869
|
// Array member 3 is used below to keep with current getimagesize standards.
|
870
|
$gis[3] = "width={$gis[0]} height={$gis[1]}";
|
871
|
ImageDestroy($im);
|
872
|
return $gis;
|
873
|
}
|
874
|
|
875
|
/**
|
876
|
* Compose function to create markup for a media item with mime type directory 'application'
|
877
|
*
|
878
|
* @param $media_representation
|
879
|
* A cdm MediaRepresentation object
|
880
|
* @param $feature
|
881
|
* A cdm feature term
|
882
|
*
|
883
|
* @ingroup compose
|
884
|
*/
|
885
|
function compose_cdm_media_mime_application($media_representation, $feature) {
|
886
|
|
887
|
$out = '';
|
888
|
if (!empty($representation->parts)) {
|
889
|
foreach ($media_representation->parts as $part) {
|
890
|
$attributes = [
|
891
|
'title' => theme('cdm_feature_name', ['feature_name' => $feature->representation_L10n]),
|
892
|
'target' => '_blank',
|
893
|
];
|
894
|
/*
|
895
|
$attributes = array('title'=>$feature->representation_L10n,'target'=>'_blank');
|
896
|
$attributes = array('title'=>'original publication', 'target'=>'_blank');
|
897
|
*/
|
898
|
$out .= l(media_feature_icon($feature, $part->uri), $part->uri, [
|
899
|
'attributes' => $attributes,
|
900
|
'absolute' => TRUE,
|
901
|
'html' => TRUE,
|
902
|
]);
|
903
|
}
|
904
|
}
|
905
|
return $out;
|
906
|
}
|
907
|
|
908
|
|
909
|
/**
|
910
|
* Compose function to create markup for a media item with mime type directory 'image'
|
911
|
*
|
912
|
* @param $media_representation
|
913
|
* A cdm MediaRepresentation object
|
914
|
* @param $feature
|
915
|
* A cdm feature term
|
916
|
* @ingroup compose
|
917
|
*/
|
918
|
function compose_cdm_media_mime_image($media_representation, $feature) {
|
919
|
|
920
|
$out = '';
|
921
|
// TODO thickbox is not used anymore -> delete?
|
922
|
$attributes = array(
|
923
|
'class' => 'thickbox',
|
924
|
'rel' => 'representation-' . $media_representation->uuid,
|
925
|
'title' => $feature->representation_L10n,
|
926
|
);
|
927
|
for ($i = 0; $part = $media_representation->parts[$i]; $i++) {
|
928
|
if ($i == 0) {
|
929
|
$out .= l(media_feature_icon($feature, $part->uri), $part->uri, array(
|
930
|
'attributes' => $attributes,
|
931
|
'absolute' => TRUE,
|
932
|
'html' => TRUE,
|
933
|
));
|
934
|
}
|
935
|
else {
|
936
|
$out .= l('', $part->uri, array(
|
937
|
'attributes' => $attributes,
|
938
|
'absolute' => TRUE,
|
939
|
));
|
940
|
}
|
941
|
}
|
942
|
return $out;
|
943
|
}
|
944
|
|
945
|
/**
|
946
|
* Compose function for captions of media elements. This method is usually called from
|
947
|
* within the cdm_media_gallerie() function or indirectly via AHAH.
|
948
|
*
|
949
|
* @param media
|
950
|
* the cdm media object to show the captions for
|
951
|
* @param elements
|
952
|
* an array which defining the caption elements to show up
|
953
|
* example:
|
954
|
* Show 'title', 'description', 'file', 'filename' in the caption:
|
955
|
* array('title', 'description', 'file', 'filename')
|
956
|
* @return array
|
957
|
* A drupal render array
|
958
|
*
|
959
|
* @ingroup compose
|
960
|
*/
|
961
|
function compose_cdm_media_caption($media, $elements = null, $sources_as_content = FALSE) {
|
962
|
|
963
|
if($elements === null){
|
964
|
$elements = ['title', 'description', 'artist', 'location', 'rights'];
|
965
|
}
|
966
|
$media_metadata = read_media_metadata($media);
|
967
|
|
968
|
$doTitle = !$elements || array_search('title', $elements) !== FALSE;
|
969
|
$doDescription = !$elements || array_search('description', $elements) !== FALSE;
|
970
|
$doArtist = !$elements || array_search('artist', $elements) !== FALSE;
|
971
|
$doMediacreated = true; //!$elements || array_search('mediacreated', $elements) !== FALSE;
|
972
|
$doLocation = !$elements || array_search('location', $elements) !== FALSE;
|
973
|
$doRights = !$elements || array_search('rights', $elements) !== FALSE;
|
974
|
|
975
|
$descriptionPrefix = "";
|
976
|
$footnote_list_key = cdm_media_foot_note_key($media);
|
977
|
|
978
|
// handle sources and annotations
|
979
|
cdm_lazyload_array_field('media', 'annotations', $media);
|
980
|
RenderHints::setAnnotationsAndSourceConfig([
|
981
|
'sources_as_content' => $sources_as_content,
|
982
|
'link_to_name_used_in_source' => TRUE,
|
983
|
'link_to_reference' => FALSE,
|
984
|
'add_footnote_keys' => !$sources_as_content,
|
985
|
'bibliography_aware' => FALSE
|
986
|
]);
|
987
|
$annotations_and_sources = handle_annotations_and_sources(
|
988
|
$media, NULL, $footnote_list_key
|
989
|
);
|
990
|
|
991
|
$render_array = [];
|
992
|
|
993
|
|
994
|
// Title.
|
995
|
if ($doTitle) {
|
996
|
$title_string = $media_metadata['title'];
|
997
|
$title_string = trim($title_string);
|
998
|
if (!isset_not_empty($title_string) && !($doDescription && isset_not_empty($media_metadata['description']))) {
|
999
|
// Use filename as fallback option if no description and no source citations are available.
|
1000
|
$title_string = $media_metadata['filename'];
|
1001
|
}
|
1002
|
$title_string .= $annotations_and_sources->footNoteKeysMarkup(); // placing the footnote keys here is not optimal, see #6329 A.1.
|
1003
|
$render_array['title'] = markup_to_render_array('<div class="title">' . $title_string . '</div>');
|
1004
|
}
|
1005
|
|
1006
|
// Description.
|
1007
|
if ($media_metadata['description'] && $doDescription) {
|
1008
|
$render_array['description'] = markup_to_render_array('<p class="description">' . $media_metadata['description'] . '</p>');
|
1009
|
}
|
1010
|
|
1011
|
// $render_array['dl'] = markup_to_render_array('<dl class="media-caption">');
|
1012
|
|
1013
|
$groups = array();
|
1014
|
// Artist.
|
1015
|
if ($media_metadata['artist'] && $doArtist) {
|
1016
|
_description_list_group_add($groups, t('Artist') . ':', $media_metadata['artist'] );
|
1017
|
}
|
1018
|
// MediaCreated
|
1019
|
if ($media_metadata['mediacreated'] && $doMediacreated) {
|
1020
|
_description_list_group_add($groups, t('Created') . ':', $media_metadata['mediacreated'] );
|
1021
|
}
|
1022
|
// Location.
|
1023
|
if ($doLocation) {
|
1024
|
$location = '';
|
1025
|
$location .= $media_metadata['location']['sublocation'];
|
1026
|
if ($location && $media_metadata['location']['city']) {
|
1027
|
$location .= ', ';
|
1028
|
}
|
1029
|
$location .= $media_metadata['location']['city'];
|
1030
|
if ($location && $media_metadata['location']['province']) {
|
1031
|
$location .= ', ';
|
1032
|
}
|
1033
|
$location .= $media_metadata['location']['province'];
|
1034
|
if ($location && $media_metadata['location']['country']) {
|
1035
|
$location .= ' (' . $media_metadata['location']['country'] . ')';
|
1036
|
}
|
1037
|
else {
|
1038
|
$location .= $media_metadata['location']['country'];
|
1039
|
}
|
1040
|
if ($location) {
|
1041
|
_description_list_group_add($groups, t('Location') . ':', $location );
|
1042
|
}
|
1043
|
}
|
1044
|
// Rights.
|
1045
|
if ($doRights) {
|
1046
|
$groups = array_merge($groups, cdm_rights_as_dl_groups($media_metadata['rights']));
|
1047
|
}
|
1048
|
|
1049
|
if($annotations_and_sources->hasSourceReferences()){
|
1050
|
$sources_label = count($annotations_and_sources->getSourceReferences()) > 1 ? t('Sources') : t('Source');
|
1051
|
_description_list_group_add($groups, $sources_label . ':', markup_to_render_array(join('; ', $annotations_and_sources->getSourceReferences())) );
|
1052
|
}
|
1053
|
|
1054
|
// TODO add all other metadata elements generically.
|
1055
|
|
1056
|
$description_list = array(
|
1057
|
'#theme' => 'description_list',
|
1058
|
'#groups' => $groups,
|
1059
|
'#attributes' => array('class' => 'media-caption')
|
1060
|
);
|
1061
|
$render_array['description_list'] = $description_list;
|
1062
|
$render_array['footnotes'] = markup_to_render_array(render_footnotes(cdm_media_foot_note_key($media)));
|
1063
|
|
1064
|
return $render_array;
|
1065
|
}
|
1066
|
|
1067
|
/**
|
1068
|
* @param $media
|
1069
|
*
|
1070
|
* @return string
|
1071
|
*/
|
1072
|
function cdm_media_foot_note_key($media) {
|
1073
|
return 'media-' . $media->uuid;
|
1074
|
}
|
1075
|
|