diff options
Diffstat (limited to 'views/default/icon/default.php')
-rw-r--r-- | views/default/icon/default.php | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/views/default/icon/default.php b/views/default/icon/default.php index 3ef1a05a1..7f13a1189 100644 --- a/views/default/icon/default.php +++ b/views/default/icon/default.php @@ -34,17 +34,39 @@ if (isset($vars['href'])) { $url = $vars['href']; } -$img = elgg_view('output/img', array( +$icon_sizes = elgg_get_config('icon_sizes'); +$size = $vars['size']; + +if (!isset($vars['width'])) { + $vars['width'] = $size != 'master' ? $icon_sizes[$size]['w'] : null; +} +if (!isset($vars['height'])) { + $vars['height'] = $size != 'master' ? $icon_sizes[$size]['h'] : null; +} + +$img_params = array( 'src' => $entity->getIconURL($vars['size']), - 'alt' => $title, - 'class' => $class, -)); + 'alt' => $title, +); + +if (!empty($class)) { + $img_params['class'] = $class; +} + +if (!empty($vars['width'])) { + $img_params['width'] = $vars['width']; +} + +if (!empty($vars['height'])) { + $img_params['height'] = $vars['height']; +} + +$img = elgg_view('output/img', $img_params); if ($url) { $params = array( 'href' => $url, 'text' => $img, - 'title' => $title, 'is_trusted' => true, ); $class = elgg_extract('link_class', $vars, ''); |