aboutsummaryrefslogtreecommitdiff
path: root/mod/categories/views/default/output/categories.php
blob: 38df8371637d2ef877844b614ad4a66cec28186b (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
<?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() . 'pg/categories/list/?category=' . urlencode($category);
			if (!empty($linkstr)) {
				$linkstr .= ', ';
			}
			$linkstr .= '<a href="'.$link.'">' . $category . '</a>';
		}
	}

}

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