This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.php
executable file
·60 lines (54 loc) · 1.59 KB
/
template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @file
* template.php
*/
/**
* Returns HTML for an image using a specific Colorbox image style.
*
* @param $variables
* An associative array containing:
* - image: image item as array.
* - path: The path of the image that should be displayed in the Colorbox.
* - title: The title text that will be used as a caption in the Colorbox.
* - gid: Gallery id for Colorbox image grouping.
*
* @ingroup themeable
*/
function azori_colorbox_imagefield($variables) {
$class = array('colorbox');
if ($variables['image']['style_name'] == 'hide') {
$image = '';
$class[] = 'js-hide';
}
elseif (!empty($variables['image']['style_name'])) {
$image = theme('image_style', $variables['image']);
}
else {
$image = theme('image', $variables['image']);
}
$options = drupal_parse_url($variables['path']);
$options += array(
'html' => TRUE,
'attributes' => array(
'title' => $variables['title'],
'class' => $class,
'rel' => $variables['gid'],
),
'language' => array('language' => NULL),
);
// original colorbox markup ends here
$colorboxlink = l($image, $options['path'], $options);
$options = drupal_parse_url($variables['path']);
$options += array(
'html' => TRUE,
'attributes' => array(
'title' => $variables['title'],
'class' => 'colorbox-download',
'target' => '_new',
),
'language' => array('language' => NULL),
);
$imagelink = l("Download", $options['path'], $options);
return '<div class="colorbox-wrapper">'.$colorboxlink.$imagelink.'<span class="colorbox-magnifier">+</span></div>';
}