aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/views.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-29 20:25:16 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-29 20:25:16 +0000
commit30caa93f4d668cad70c903d835c6d1b6a6f6953e (patch)
tree6dfaf79e381094ef0e0de11c4fea2b0d8038925c /engine/lib/views.php
parent7e434bda73195ad81d728c97823c14c09383438d (diff)
downloadelgg-30caa93f4d668cad70c903d835c6d1b6a6f6953e.tar.gz
elgg-30caa93f4d668cad70c903d835c6d1b6a6f6953e.tar.bz2
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
Diffstat (limited to 'engine/lib/views.php')
-rw-r--r--engine/lib/views.php28
1 files changed, 28 insertions, 0 deletions
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
@@ -1057,6 +1057,34 @@ function elgg_view_image_block($image, $body, $vars = array()) {
}
/**
+ * 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.
*
* @param string $icon The icon for the listing