From ce7f8e4f6763a2f1ce10b90c99c839ea2b46ee1d Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 11 Feb 2011 21:38:38 +0000 Subject: Added $viewer callback option for elgg_list_entities(). git-svn-id: http://code.elgg.org/elgg/trunk@8117 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/engine/lib/entities.php b/engine/lib/entities.php index bc097e4ab..fb4cdd2e6 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -764,7 +764,7 @@ function elgg_get_entities(array $options = array()) { 'wheres' => array(), 'joins' => array(), - 'callback' => 'entity_row_to_elggstar', + 'callback' => 'entity_row_to_elggstar', ); $options = array_merge($defaults, $options); @@ -1136,12 +1136,16 @@ $time_created_lower = NULL, $time_updated_upper = NULL, $time_updated_lower = NU * * @tip Pagination is handled automatically. * + * @internal This also provides the views for elgg_view_annotation(). + * * @param array $options Any options from $getter options plus: * full_view => BOOL Display full view entities * list_type_toggle => BOOL Display gallery / list switch * pagination => BOOL Display pagination links + * gallery => BOOL display in gallery view * - * @param mixed $getter The entity getter function to use to fetch the entities + * @param mixed $getter The entity getter function to use to fetch the entities + * @param mixed $viewer The function to use to view the entity list. * * @return string * @since 1.7 @@ -1149,7 +1153,9 @@ $time_created_lower = NULL, $time_updated_upper = NULL, $time_updated_lower = NU * @see elgg_view_entity_list() * @link http://docs.elgg.org/Entities/Output */ -function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entities') { +function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entities', + $viewer = 'elgg_view_entity_list') { + $defaults = array( 'offset' => (int) max(get_input('offset', 0), 0), 'limit' => (int) max(get_input('limit', 10), 0), @@ -1174,7 +1180,7 @@ function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entiti $options['count'] = $count; - return elgg_view_entity_list($entities, $options); + return $viewer($entities, $options); } /** -- cgit v1.2.3