getURL()) * - search_time (defaults to entity->time_updated or entity->time_created) * * @uses $vars['entity'] Entity returned in a search */ $entity = $vars['entity']; if (empty($entity) || !elgg_instanceof($entity, 'object', 'discussion_reply')) { return; } $topic = $entity->getContainerEntity(); if (empty($topic) || !elgg_instanceof($topic, 'object', 'groupforumtopic')) { return; } $icon = $entity->getVolatileData('search_icon'); if (!$icon) { // 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_entity_icon($entity, 'tiny'); } elseif ($owner = $entity->getOwnerEntity()) { $icon = elgg_view_entity_icon($owner, 'tiny'); } else { // display a generic icon if no owner, though there will probably be // other problems if the owner can't be found. $icon = elgg_view_entity_icon($entity, 'tiny'); } } $title = $entity->getVolatileData('search_matched_title'); $description = $entity->getVolatileData('search_matched_description'); $extra_info = $entity->getVolatileData('search_matched_extra'); $url = $entity->getVolatileData('search_url'); if (!$title) { $title = elgg_echo('discussion:search:title', array($topic->title)); } if (!$url) { $url = $topic->getURL(); } $title = "$title"; $time = $entity->getVolatileData('search_time'); if (!$time) { $tc = $entity->time_created; $tu = $entity->time_updated; $time = elgg_view_friendly_time(($tu > $tc) ? $tu : $tc); } $body = "

$title

$description"; if ($extra_info) { $body .= "

$extra_info

"; } $body .= "

$time

"; echo elgg_view_image_block($icon, $body);