]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added a convience function for the media content pattern - is elgg_view_media() a...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 5 Dec 2010 19:36:32 +0000 (19:36 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 5 Dec 2010 19:36:32 +0000 (19:36 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7538 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/views.php
mod/blog/views/default/object/blog.php
views/default/annotation/generic_comment.php

index e4592d4b762e00c6b895ee19b31c3909cbd18c4b..70b4b833d894ac722fac63fadb3e788777d7fa1b 100644 (file)
@@ -970,6 +970,27 @@ function elgg_view_comments($entity, $add_comment = true) {
        }
 }
 
+/**
+ * Wrapper function for the media display pattern.
+ *
+ * Fixed width media on the side (image, icon, flash, etc.).
+ * Descriptive content filling the rest of the column.
+ *
+ * This is a shortcut for {@elgg_view layout_elements/media}.
+ *
+ * @param string $icon The icon and other information
+ * @param string $body Description content
+ * @param string $vars Additional parameters for the view
+ *
+ * @return string
+ * @since 1.8.0
+ */
+function elgg_view_media($icon, $body, $vars = array()) {
+       $vars['icon'] = $icon;
+       $vars['body'] = $body;
+       return elgg_view('layout_elements/media', $vars);
+}
+
 /**
  * Wrapper function to display search listings.
  *
@@ -977,8 +998,10 @@ function elgg_view_comments($entity, $add_comment = true) {
  * @param string $info Any information that needs to be displayed.
  *
  * @return string The HTML (etc) representing the listing
+ * @deprecated 1.8 use elgg_view_media()
  */
 function elgg_view_listing($icon, $info) {
+       elgg_deprecated_notice('elgg_view_listing deprecated by elgg_view_media', 1.8);
        return elgg_view('entities/entity_listing', array('icon' => $icon, 'info' => $info));
 }
 
index 75df11b62b48bbe36ba7b29101950a2fd1c333a8..08e1740630b1d71e5b7f5af92c2212f26eab76c9 100644 (file)
@@ -92,13 +92,9 @@ if ($full) {
 </div>
 HTML;
 
-       $params = array(
-               'icon' => $owner_icon,
-               'body' => $info,
-       );
-       $blog_info = elgg_view('layout_elements/media', $params);
+       $blog_info = elgg_view_media($owner_icon, $info);
 
-echo <<<HTML
+       echo <<<HTML
 $header
 $blog_info
 <div class="blog_post elgg-content">
@@ -124,9 +120,5 @@ HTML;
        </div>
 HTML;
 
-       $params = array(
-               'icon' => $owner_icon,
-               'body' => $body,
-       );
-       echo elgg_view('layout_elements/media', $params);
+       echo elgg_view_media($owner_icon, $body);
 }
index 3fc55e84ae85ddb128d9aa421d6ae207c7d9c5c5..bb0127bfebb599f7f134a304e2afb6a41f4576f3 100644 (file)
@@ -42,11 +42,7 @@ if ($full_view) {
 <span class="entity-subtext">$commenter_link $on <span class='entity-title'>$entity_link</span> ($friendlytime)</span>
 HTML;
 
-       $params = array(
-               'icon' => $commenter_icon,
-               'body' => $body,
-       );
-       echo elgg_view('layout_elements/media', $params);
+       echo elgg_view_media($commenter_icon, $body);
        
        // @todo remove this once the full view has been rewritten
        return true;