diff options
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/icon/default.php | 11 | ||||
-rw-r--r-- | views/default/icon/user/default.php | 51 | ||||
-rw-r--r-- | views/default/input/friendspicker.php | 2 | ||||
-rw-r--r-- | views/default/input/userpicker.php | 2 | ||||
-rw-r--r-- | views/default/profile/icon.php | 2 | ||||
-rw-r--r-- | views/default/river/user/default/profileiconupdate.php | 5 |
6 files changed, 53 insertions, 20 deletions
diff --git a/views/default/icon/default.php b/views/default/icon/default.php index 6aeef204b..ec39e59f2 100644 --- a/views/default/icon/default.php +++ b/views/default/icon/default.php @@ -9,6 +9,7 @@ * @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']; @@ -37,11 +38,17 @@ $img_src = $entity->getIconURL($vars['size']); $img = "<img $class src=\"$img_src\" alt=\"$title\" />"; if ($url) { - echo elgg_view('output/url', array( + $params = array( 'href' => $url, 'text' => $img, 'is_trusted' => true, - )); + ); + $class = elgg_extract('link_class', $vars, ''); + if ($class) { + $params['class'] = $class; + } + + echo elgg_view('output/url', $params); } else { echo $img; } diff --git a/views/default/icon/user/default.php b/views/default/icon/user/default.php index 906371cf8..54885805b 100644 --- a/views/default/icon/user/default.php +++ b/views/default/icon/user/default.php @@ -5,10 +5,13 @@ * Rounded avatar corners - CSS3 method * uses avatar as background image so we can clip it with border-radius in supported browsers * - * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - * @uses $vars['size'] The size - tiny, small, medium or large. (medium) - * @uses $vars['hover'] Display the hover menu? (true) - * @uses $vars['class'] Optional class added to the .elgg-avatar div + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + * @uses $vars['size'] The size - tiny, small, medium or large. (medium) + * @uses $vars['use_hover'] Display the hover menu? (true) + * @uses $vars['use_link'] Wrap a link around image? (true) + * @uses $vars['class'] Optional class added to the .elgg-avatar div + * @uses $vars['img_class'] Optional CSS class added to img + * @uses $vars['link_class'] Optional CSS class for the link */ $user = elgg_extract('entity', $vars, elgg_get_logged_in_user_entity()); @@ -22,6 +25,8 @@ if (isset($vars['class'])) { $class = "$class {$vars['class']}"; } +$use_link = elgg_extract('use_link', $vars, true); + if (!($user instanceof ElggUser)) { return true; } @@ -35,19 +40,31 @@ if (!$icontime) { } $js = elgg_extract('js', $vars, ''); +if ($js) { + elgg_deprecated_notice("Passing 'js' to icon views is deprecated.", 1.8, 5); +} + +$img_class = ''; +if (isset($vars['img_class'])) { + $img_class = "class=\"{$vars['img_class']}\""; +} -$hover = elgg_extract('hover', $vars, true); +$use_hover = elgg_extract('use_hover', $vars, true); if (isset($vars['override'])) { - elgg_deprecated_notice("Use 'hover' rather than 'override' with user avatars", 1.8, 5); - $hover = false; + elgg_deprecated_notice("Use 'use_hover' rather than 'override' with user avatars", 1.8, 5); + $use_hover = false; +} +if (isset($vars['hover'])) { + // only 1.8.0 was released with 'hover' as the key + $use_hover = $vars['hover']; } $spacer_url = elgg_get_site_url() . '_graphics/spacer.gif'; $icon_url = $user->getIconURL($size); -$icon = "<img src=\"$spacer_url\" alt=\"$name\" title=\"$name\" $js style=\"background: url($icon_url) no-repeat;\" />"; +$icon = "<img src=\"$spacer_url\" alt=\"$name\" title=\"$name\" $img_class $js style=\"background: url($icon_url) no-repeat;\" />"; -$show_menu = $hover && (elgg_is_admin_logged_in() || !$user->isBanned()); +$show_menu = $use_hover && (elgg_is_admin_logged_in() || !$user->isBanned()); ?> <div class="<?php echo $class; ?>"> @@ -63,10 +80,16 @@ if ($show_menu) { echo elgg_view_menu('user_hover', $params); } -echo elgg_view('output/url', array( - 'href' => $user->getURL(), - 'text' => $icon, - 'is_trusted' => true, -)); +if ($use_link) { + $class = elgg_extract('link_class', $vars, ''); + echo elgg_view('output/url', array( + 'href' => $user->getURL(), + 'text' => $icon, + 'is_trusted' => true, + 'class' => $class, + )); +} else { + echo "<a>$icon</a>"; +} ?> </div> diff --git a/views/default/input/friendspicker.php b/views/default/input/friendspicker.php index ecf468da3..b41449fbf 100644 --- a/views/default/input/friendspicker.php +++ b/views/default/input/friendspicker.php @@ -187,7 +187,7 @@ if (!isset($vars['replacement'])) { } //echo "<p>" . $user->name . "</p>"; - $label = elgg_view_entity_icon($friend, 'tiny', array('hover' => false)); + $label = elgg_view_entity_icon($friend, 'tiny', array('use_hover' => false)); $options[$label] = $friend->getGUID(); if ($vars['highlight'] == 'all' diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index 5c4b297b1..246c462da 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -27,7 +27,7 @@ function user_picker_add_user($user_id) { return false; } - $icon = elgg_view_entity_icon($user, 'tiny', array('hover' => false)); + $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => false)); // this html must be synced with the userpicker.js library $code = '<li><div class="elgg-image-block">'; diff --git a/views/default/profile/icon.php b/views/default/profile/icon.php index a69c41f1e..5f06cfd54 100644 --- a/views/default/profile/icon.php +++ b/views/default/profile/icon.php @@ -12,6 +12,6 @@ elgg_deprecated_notice('The profile/icon view was deprecated. Use elgg_view_entity_icon()', 1.8); $override = elgg_extract('override', $vars, false); -$vars['hover'] = !$override; +$vars['use_hover'] = !$override; echo elgg_view('icon/user/default', $vars); diff --git a/views/default/river/user/default/profileiconupdate.php b/views/default/river/user/default/profileiconupdate.php index 160ffd252..271064a06 100644 --- a/views/default/river/user/default/profileiconupdate.php +++ b/views/default/river/user/default/profileiconupdate.php @@ -17,5 +17,8 @@ $string = elgg_echo('river:update:user:avatar', array($subject_link)); echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'summary' => $string, - 'attachments' => elgg_view_entity_icon($subject, 'tiny', array('hover' => false)), + 'attachments' => elgg_view_entity_icon($subject, 'tiny', array( + 'use_hover' => false, + 'use_link' => false, + )), )); |