aboutsummaryrefslogtreecommitdiff
path: root/mod/lightpics/views/default/icon/object/album.php
blob: ddc6a8a560748b17a9df3c2627f924bcc306a82d (plain)
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
<?php
/**
 * Image icon view
 *
 * @uses $vars['entity']     The entity the icon represents - uses getIconURL() method
 * @uses $vars['size']       tiny, small (default), large, master
 * @uses $vars['href']       Optional override for link
 * @uses $vars['img_class']  Optional CSS class added to img
 * @uses $vars['link_class'] Optional CSS class added to link
 *
 * @author Cash Costello
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
 */

$album = $vars['entity'];

$cover_guid = $album->getCoverImageGuid();
if ($cover_guid) {
	$vars['title'] = $album->getTitle();
	$vars['href'] = $album->getURL();
	echo elgg_view_entity_icon(get_entity($cover_guid), $vars['size'], $vars);
} else {
	$url = "mod/lightpics/graphics/empty_album.png";
	$url = elgg_normalize_url($url);
	$img = elgg_view('output/img', array(
		'src' => $url,
		'class' => 'elgg-photo',
		'title' => $album->getTitle(),
		'alt' => $album->getTitle(),
	));

	$params = array(
		'href' => $url,
		'text' => $img,
		'is_trusted' => true,
	);
	if (isset($vars['link_class'])) {
		$params['class'] = $vars['link_class'];
	}
	echo elgg_view('output/url', $params);
}