aboutsummaryrefslogtreecommitdiff
path: root/mod/categories/views/default/output/categories.php
blob: 4b3a3fb6af44a2b4a034d302287dbe4e7f0ed554 (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
<?php
/**
 * View categories on an entity
 *
 * @uses $vars['entity']
 */

$linkstr = '';
if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) {

	$categories = $vars['entity']->universal_categories;
	if (!empty($categories)) {
		if (!is_array($categories)) {
			$categories = array($categories);
		}
		foreach($categories as $category) {
			$link = elgg_get_site_url() . 'categories/list?category=' . urlencode($category);
			if (!empty($linkstr)) {
				$linkstr .= ', ';
			}
			$linkstr .= '<a href="'.$link.'">' . $category . '</a>';
		}
	}

}

if ($linkstr) {
	echo '<p class="elgg-output-categories">' . elgg_echo('categories') . ": $linkstr</p>";
}