diff options
author | Sem <sembrestels@riseup.net> | 2013-11-09 16:22:50 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2013-11-09 16:22:50 +0100 |
commit | f448cd91f9ecebea37daf40aada2fa1a20200817 (patch) | |
tree | 4636059da6a1be133a4974e5098b7c1e08944dd5 /mod/lightpics/views/default/icon/object/image.php | |
parent | 52335325e5ea8c89c711e1ba40d9ac1657004e61 (diff) | |
parent | 324f39c3a9aa41e9e23bafba38882a2b72f62441 (diff) | |
download | elgg-f448cd91f9ecebea37daf40aada2fa1a20200817.tar.gz elgg-f448cd91f9ecebea37daf40aada2fa1a20200817.tar.bz2 |
Add 'mod/lightpics/' from commit '324f39c3a9aa41e9e23bafba38882a2b72f62441'
git-subtree-dir: mod/lightpics
git-subtree-mainline: 52335325e5ea8c89c711e1ba40d9ac1657004e61
git-subtree-split: 324f39c3a9aa41e9e23bafba38882a2b72f62441
Diffstat (limited to 'mod/lightpics/views/default/icon/object/image.php')
-rw-r--r-- | mod/lightpics/views/default/icon/object/image.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mod/lightpics/views/default/icon/object/image.php b/mod/lightpics/views/default/icon/object/image.php new file mode 100644 index 000000000..9087fc3d8 --- /dev/null +++ b/mod/lightpics/views/default/icon/object/image.php @@ -0,0 +1,62 @@ +<?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 + * @uses $vars['title'] Optional title override + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$entity = $vars['entity']; + +$sizes = array('master', 'large', 'small', 'tiny'); +// Get size +if (!in_array($vars['size'], $sizes)) { + $vars['size'] = 'small'; +} + +if (!isset($vars['title'])) { + $title = $entity->getTitle(); +} else { + $title = $vars['title']; +} + +$url = isset($vars['href']) ? $vars['href'] : $entity->getURL(); +if (isset($vars['href'])) { + $url = $vars['href']; +} + +$class = ''; +if (isset($vars['img_class'])) { + $class = $vars['img_class']; +} +$class = "elgg-photo $class"; + +$img_src = $entity->getIconURL($vars['size']); +$img_src = elgg_format_url($img_src); +$img = elgg_view('output/img', array( + 'src' => $img_src, + 'class' => $class, + 'title' => $title, + 'alt' => $title, +)); + +if ($url) { + $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); +} else { + echo $img; +} |