diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-02 15:30:06 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-02 15:30:06 +0000 |
commit | 76f4ad60418b353a5c90814d25d06aef249924e2 (patch) | |
tree | cf0ca873c5b2a79390cf55f7469c583cae309b99 /mod/search | |
parent | d577476d798103dadf5b79fbf923831de9cb40d0 (diff) | |
download | elgg-76f4ad60418b353a5c90814d25d06aef249924e2.tar.gz elgg-76f4ad60418b353a5c90814d25d06aef249924e2.tar.bz2 |
Updated the the default search entity view to check for users and groups and properly display their profile icons.
git-svn-id: http://code.elgg.org/elgg/trunk@3983 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/search')
-rw-r--r-- | mod/search/search_hooks.php | 2 | ||||
-rw-r--r-- | mod/search/views/default/search/entity.php | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php index b61f12339..cc70f43ea 100644 --- a/mod/search/search_hooks.php +++ b/mod/search/search_hooks.php @@ -106,6 +106,8 @@ function search_groups_hook($hook, $type, $value, $params) { /** * Return default results for searches on users. * + * @todo add profile field MD searching + * * @param unknown_type $hook * @param unknown_type $type * @param unknown_type $value diff --git a/mod/search/views/default/search/entity.php b/mod/search/views/default/search/entity.php index 06dd54f39..92f6aa41d 100644 --- a/mod/search/views/default/search/entity.php +++ b/mod/search/views/default/search/entity.php @@ -10,12 +10,21 @@ $entity = $vars['entity']; -if ($owner = $entity->getOwnerEntity()) { - $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'small')); -} elseif ($entity instanceof ElggUser) { +// display the entity's owner by default if available. +// @todo allow an option to switch to displaying the entity's icon instead. +$type = $entity->getType(); +if ($type == 'user' || $type == 'group') { $icon = elgg_view('profile/icon', array('entity' => $entity, 'size' => 'small')); +} elseif ($owner = $entity->getOwnerEntity()) { + $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'small')); } else { - $icon = ''; + // display a generic icon if no owner, though there will probably be + // other problems if the owner can't be found. + $icon = elgg_view( + 'graphics/icon', array( + 'entity' => $entity, + 'size' => 'small', + )); } $title = $entity->getVolatileData('search_matched_title'); |