aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/input.php12
-rw-r--r--engine/lib/views.php4
-rw-r--r--mod/developers/views/default/theme_preview/icons/avatars.php4
-rw-r--r--mod/file/views/default/icon/object/file.php8
-rw-r--r--mod/groups/views/default/groups/invitationrequests.php2
-rw-r--r--mod/groups/views/default/groups/membershiprequests.php2
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/forminternals.php2
-rw-r--r--mod/profile/views/default/profile/owner_block.php2
-rw-r--r--views/default/icon/default.php11
-rw-r--r--views/default/icon/user/default.php51
-rw-r--r--views/default/input/friendspicker.php2
-rw-r--r--views/default/input/userpicker.php2
-rw-r--r--views/default/profile/icon.php2
-rw-r--r--views/default/river/user/default/profileiconupdate.php5
14 files changed, 75 insertions, 34 deletions
diff --git a/engine/lib/input.php b/engine/lib/input.php
index 2f68195f2..57e35786f 100644
--- a/engine/lib/input.php
+++ b/engine/lib/input.php
@@ -301,12 +301,12 @@ function input_livesearch_page_handler($page) {
}
$output = elgg_view_list_item($entity, array(
- 'hover' => false,
+ 'use_hover' => false,
'class' => 'elgg-autocomplete-item',
));
$icon = elgg_view_entity_icon($entity, 'tiny', array(
- 'hover' => false,
+ 'use_hover' => false,
));
$result = array(
@@ -344,12 +344,12 @@ function input_livesearch_page_handler($page) {
}
$output = elgg_view_list_item($entity, array(
- 'hover' => false,
+ 'use_hover' => false,
'class' => 'elgg-autocomplete-item',
));
$icon = elgg_view_entity_icon($entity, 'tiny', array(
- 'hover' => false,
+ 'use_hover' => false,
));
$result = array(
@@ -391,12 +391,12 @@ function input_livesearch_page_handler($page) {
}
$output = elgg_view_list_item($entity, array(
- 'hover' => false,
+ 'use_hover' => false,
'class' => 'elgg-autocomplete-item',
));
$icon = elgg_view_entity_icon($entity, 'tiny', array(
- 'hover' => false,
+ 'use_hover' => false,
));
$result = array(
diff --git a/engine/lib/views.php b/engine/lib/views.php
index 2ec56c97e..6ca68ac8c 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -860,7 +860,9 @@ function elgg_view_entity(ElggEntity $entity, $vars = array(), $bypass = true, $
*
* @param ElggEntity $entity The entity to display
* @param string $size The size: tiny, small, medium, large
- * @param array $vars An array of variables to pass to the view
+ * @param array $vars An array of variables to pass to the view. Some possible
+ * variables are img_class and link_class. See the
+ * specific icon view for more parameters.
*
* @return string HTML to display or false
*/
diff --git a/mod/developers/views/default/theme_preview/icons/avatars.php b/mod/developers/views/default/theme_preview/icons/avatars.php
index cbce5bc7d..f50a6b70d 100644
--- a/mod/developers/views/default/theme_preview/icons/avatars.php
+++ b/mod/developers/views/default/theme_preview/icons/avatars.php
@@ -18,7 +18,7 @@
<?php
foreach ($sizes as $size) {
echo '<td>';
- echo elgg_view_entity_icon($user, $size, array('hover' => false));
+ echo elgg_view_entity_icon($user, $size, array('use_hover' => false));
echo '</td>';
}
?>
@@ -28,7 +28,7 @@
<?php
foreach ($sizes as $size) {
echo '<td>';
- echo elgg_view_entity_icon($group, $size, array('hover' => false));
+ echo elgg_view_entity_icon($group, $size, array('use_hover' => false));
echo '</td>';
}
?>
diff --git a/mod/file/views/default/icon/object/file.php b/mod/file/views/default/icon/object/file.php
index 51a4469e9..a3190310b 100644
--- a/mod/file/views/default/icon/object/file.php
+++ b/mod/file/views/default/icon/object/file.php
@@ -5,6 +5,7 @@
* @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 added to link
*/
@@ -25,8 +26,13 @@ if (isset($vars['href'])) {
}
$class = '';
+if (isset($vars['img_class'])) {
+ $class = $vars['img_class'];
+}
if ($entity->thumbnail) {
- $class = 'class="elgg-photo"';
+ $class = "class=\"elgg-photo $class\"";
+} else if ($class) {
+ $class = "class=\"$class\"";
}
$img_src = $entity->getIconURL($vars['size']);
diff --git a/mod/groups/views/default/groups/invitationrequests.php b/mod/groups/views/default/groups/invitationrequests.php
index e644b6bdc..94dbdf1f2 100644
--- a/mod/groups/views/default/groups/invitationrequests.php
+++ b/mod/groups/views/default/groups/invitationrequests.php
@@ -10,7 +10,7 @@ if (!empty($vars['invitations']) && is_array($vars['invitations'])) {
echo '<ul class="elgg-list">';
foreach ($vars['invitations'] as $group) {
if ($group instanceof ElggGroup) {
- $icon = elgg_view_entity_icon($group, 'tiny', array('hover' => 'true'));
+ $icon = elgg_view_entity_icon($group, 'tiny', array('use_hover' => 'true'));
$group_title = elgg_view('output/url', array(
'href' => $group->getURL(),
diff --git a/mod/groups/views/default/groups/membershiprequests.php b/mod/groups/views/default/groups/membershiprequests.php
index bc6d9af5a..9cd28262f 100644
--- a/mod/groups/views/default/groups/membershiprequests.php
+++ b/mod/groups/views/default/groups/membershiprequests.php
@@ -10,7 +10,7 @@ if (!empty($vars['requests']) && is_array($vars['requests'])) {
$user = elgg_get_logged_in_user_entity();
echo '<ul class="elgg-list">';
foreach ($vars['requests'] as $user) {
- $icon = elgg_view_entity_icon($user, 'tiny', array('hover' => 'true'));
+ $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => 'true'));
$user_title = elgg_view('output/url', array(
'href' => $user->getURL(),
diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php
index a7fbec2fd..e89ce02be 100644
--- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php
+++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php
@@ -234,7 +234,7 @@ END;
<td class="namefield">
<a href="<?php echo $friend->getURL(); ?>">
<?php
- echo elgg_view_entity_icon($friend, 'tiny', array('hover' => false));
+ echo elgg_view_entity_icon($friend, 'tiny', array('use_hover' => false));
?>
</a>
<p class="namefieldlink">
diff --git a/mod/profile/views/default/profile/owner_block.php b/mod/profile/views/default/profile/owner_block.php
index 05cb41a14..35199726a 100644
--- a/mod/profile/views/default/profile/owner_block.php
+++ b/mod/profile/views/default/profile/owner_block.php
@@ -11,7 +11,7 @@ if (!$user) {
return TRUE;
}
-$icon = elgg_view_entity_icon($user, 'large', array('hover' => 'true'));
+$icon = elgg_view_entity_icon($user, 'large', array('use_hover' => 'true'));
// grab the actions and admin menu items from user hover
$menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array());
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,
+ )),
));