aboutsummaryrefslogtreecommitdiff
path: root/views/default/icon/default.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-06 22:12:56 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-06 22:12:56 +0000
commitae6e0093ba62cc6e69f6aa41d4f163de52747418 (patch)
tree5552c8037d85ec8a0ede1c6a490097a26ee9be24 /views/default/icon/default.php
parent125dcdd329b3159808c097f02597e908be3ad8d0 (diff)
downloadelgg-ae6e0093ba62cc6e69f6aa41d4f163de52747418.tar.gz
elgg-ae6e0093ba62cc6e69f6aa41d4f163de52747418.tar.bz2
updated the file plugin to use the new icon structure
git-svn-id: http://code.elgg.org/elgg/trunk@8051 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/icon/default.php')
-rw-r--r--views/default/icon/default.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/views/default/icon/default.php b/views/default/icon/default.php
new file mode 100644
index 000000000..a29886064
--- /dev/null
+++ b/views/default/icon/default.php
@@ -0,0 +1,36 @@
+<?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
+ */
+
+$entity = $vars['entity'];
+
+$sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar');
+// Get size
+if (!in_array($vars['size'], $sizes)) {
+ $vars['size'] = "medium";
+}
+
+$url = $entity->getURL();
+if (isset($vars['href'])) {
+ $url = $vars['href'];
+}
+
+$img_src = $entity->getIcon($vars['size']);
+$img = "<img src=\"$img_src\" />";
+
+if ($url) {
+ echo elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => $img,
+ ));
+} else {
+ echo $img;
+}