aboutsummaryrefslogtreecommitdiff
path: root/mod/subgroups/views/default/icon/default.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-16 21:01:42 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-16 21:01:42 -0300
commit815bb3bf5a5e8da9a7962a4a532c3129f09d5735 (patch)
tree41bec5b730cc3dca936438f9e97810e7ab3ede0a /mod/subgroups/views/default/icon/default.php
parentc102a5c9f4e9e2f78260019ccab6098435b1df19 (diff)
parent5f6dc365a8445a48156b45912827eac39fd64fc5 (diff)
downloadelgg-815bb3bf5a5e8da9a7962a4a532c3129f09d5735.tar.gz
elgg-815bb3bf5a5e8da9a7962a4a532c3129f09d5735.tar.bz2
Merge commit '5f6dc365a8445a48156b45912827eac39fd64fc5' as 'mod/subgroups'
Diffstat (limited to 'mod/subgroups/views/default/icon/default.php')
-rw-r--r--mod/subgroups/views/default/icon/default.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/mod/subgroups/views/default/icon/default.php b/mod/subgroups/views/default/icon/default.php
new file mode 100644
index 000000000..3ef1a05a1
--- /dev/null
+++ b/mod/subgroups/views/default/icon/default.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Generic icon view.
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method
+ * @uses $vars['size'] topbar, tiny, small, medium (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 for the link
+ */
+
+$entity = $vars['entity'];
+
+$sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar');
+// Get size
+if (!in_array($vars['size'], $sizes)) {
+ $vars['size'] = "medium";
+}
+
+$class = elgg_extract('img_class', $vars, '');
+
+if (isset($entity->name)) {
+ $title = $entity->name;
+} else {
+ $title = $entity->title;
+}
+$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false);
+
+$url = $entity->getURL();
+if (isset($vars['href'])) {
+ $url = $vars['href'];
+}
+
+$img = elgg_view('output/img', array(
+ 'src' => $entity->getIconURL($vars['size']),
+ 'alt' => $title,
+ 'class' => $class,
+));
+
+if ($url) {
+ $params = array(
+ 'href' => $url,
+ 'text' => $img,
+ 'title' => $title,
+ 'is_trusted' => true,
+ );
+ $class = elgg_extract('link_class', $vars, '');
+ if ($class) {
+ $params['class'] = $class;
+ }
+
+ echo elgg_view('output/url', $params);
+} else {
+ echo $img;
+}