aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/views.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-12 15:14:33 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-12 15:14:33 +0000
commite917c26d53a7270b3ab4d2d283f72cfd32f3e1e2 (patch)
treedbff115f09f451fcc83384642254c9972e6d6767 /engine/lib/views.php
parent7dd75ce9cdb524ff27ada917608c2cc1dc31f499 (diff)
downloadelgg-e917c26d53a7270b3ab4d2d283f72cfd32f3e1e2.tar.gz
elgg-e917c26d53a7270b3ab4d2d283f72cfd32f3e1e2.tar.bz2
Refs #3085 finished support for passing $vars to elgg_view_entity()
git-svn-id: http://code.elgg.org/elgg/trunk@8660 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/views.php')
-rw-r--r--engine/lib/views.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/engine/lib/views.php b/engine/lib/views.php
index 27abf8f8e..de918e3b9 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -729,6 +729,8 @@ function elgg_view_menu($menu_name, array $vars = array()) {
*
* The entity view is called with the following in $vars:
* - ElggEntity 'entity' The entity being viewed
+ *
+ * Other common view $vars paramters:
* - bool 'full' Whether to show a full or condensed view.
*
* @tip This function can automatically appends annotations to entities if in full
@@ -736,8 +738,8 @@ function elgg_view_menu($menu_name, array $vars = array()) {
* {@link elgg_view_entity_annotations()}.
*
* @param ElggEntity $entity The entity to display
- * @param boolean $full Passed to entity view to decide how much information to show.
- * Beginning with Elgg 1.8, $full can be an array of vars for elgg_view()
+ * @param array $vars Array of variables to pass to the entity view.
+ * In Elgg 1.7 and earlier it was the boolean $full_view
* @param boolean $bypass If false, will not pass to a custom template handler.
* {@see set_template_handler()}
* @param boolean $debug Complain if views are missing
@@ -747,7 +749,7 @@ function elgg_view_menu($menu_name, array $vars = array()) {
* @link http://docs.elgg.org/Entities
* @todo The annotation hook might be better as a generic plugin hook to append content.
*/
-function elgg_view_entity(ElggEntity $entity, $full = false, $bypass = true, $debug = false) {
+function elgg_view_entity(ElggEntity $entity, $vars = array(), $bypass = true, $debug = false) {
// No point continuing if entity is null
if (!$entity || !($entity instanceof ElggEntity)) {
@@ -761,12 +763,12 @@ function elgg_view_entity(ElggEntity $entity, $full = false, $bypass = true, $de
'full' => false,
);
- if (is_array($full)) {
- $vars = $full;
+ if (is_array($vars)) {
$vars = array_merge($defaults, $vars);
} else {
+ elgg_deprecated_notice("Update your use of elgg_view_entity()", 1.8);
$vars = array(
- 'full' => $full,
+ 'full' => $vars,
);
}
@@ -795,8 +797,8 @@ function elgg_view_entity(ElggEntity $entity, $full = false, $bypass = true, $de
}
// Marcus Povey 20090616 : Speculative and low impact approach for fixing #964
- if ($full) {
- $annotations = elgg_view_entity_annotations($entity, $full);
+ if ($vars['full']) {
+ $annotations = elgg_view_entity_annotations($entity, $vars['full']);
if ($annotations) {
$contents .= $annotations;