aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggEntity.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes/ElggEntity.php')
-rw-r--r--engine/classes/ElggEntity.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index 8a7c45648..1154fd89a 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -519,13 +519,25 @@ abstract class ElggEntity extends ElggData implements
* @param string $name Annotation name
* @param int $limit Limit
* @param int $offset Offset
- * @param string $order asc or desc
+ * @param string $order Order by time: asc or desc
*
* @return array
*/
function getAnnotations($name, $limit = 50, $offset = 0, $order = "asc") {
if ((int) ($this->guid) > 0) {
- return get_annotations($this->getGUID(), "", "", $name, "", 0, $limit, $offset, $order);
+
+ $options = array(
+ 'guid' => $this->guid,
+ 'annotation_name' => $name,
+ 'limit' => $limit,
+ 'offset' => $offset,
+ );
+
+ if ($order == 'desc') {
+ $options['order_by'] = 'n_table.time_created desc';
+ }
+
+ return elgg_get_annotations($options);
} else {
return $this->temp_annotations[$name];
}