From 30caa93f4d668cad70c903d835c6d1b6a6f6953e Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 29 Dec 2010 20:25:16 +0000 Subject: Fixes #2221 - rewrite of rover functions has been completed with moving elgg_view_river_item() into the views library. The ugly C&P functions were moved into the riverdashboard plugin and new 1.7 style get/list functions were introduced git-svn-id: http://code.elgg.org/elgg/trunk@7755 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/views.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'engine/lib/views.php') diff --git a/engine/lib/views.php b/engine/lib/views.php index 396eb7c12..eff5df394 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1056,6 +1056,34 @@ function elgg_view_image_block($image, $body, $vars = array()) { return elgg_view('layout/objects/image_block', $vars); } +/** + * Returns a human-readable representation of a river item + * + * @param ElggRiverItem $item A river item object + * + * @return string|false Depending on success + */ +function elgg_view_river_item($item) { + if (!$item || !$item->getView() || !elgg_view_exists($item->getView())) { + return ''; + } + + $subject = $item->getSubjectEntity(); + $object = $item->getObjectEntity(); + if (!$subject || !$object) { + // subject is disabled or subject/object deleted + return ''; + } + + $vars = array( + 'image' => elgg_view('core/river/image', array('item' => $item)), + 'body' => elgg_view('core/river/body', array('item' => $item)), + 'image_alt' => elgg_view('core/river/controls', array('item' => $item)), + 'class' => 'elgg-river-item', + ); + return elgg_view('layout/objects/image_block', $vars); +} + /** * Wrapper function to display search listings. * -- cgit v1.2.3