summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-04-15 06:18:47 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-04-15 06:18:47 -0700
commit009b47262b9b81dc996459119af822e2e7306255 (patch)
tree47ff17aa69283baa060543d4b3f39fb85633177d
parentc58b2aaf88d9b92880bcec1419793edca9acb6fb (diff)
Only return the members element to the rest client if the item is an album. This makes it consistent to the rest client that collections will have a members element.
-rw-r--r--modules/gallery/helpers/item_rest.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php
index f52713b8..36d2ca62 100644
--- a/modules/gallery/helpers/item_rest.php
+++ b/modules/gallery/helpers/item_rest.php
@@ -78,16 +78,18 @@ class item_rest_Core {
}
$orm->order_by($order_by);
- $members = array();
- foreach ($orm->find_all() as $child) {
- $members[] = rest::url("item", $child);
- }
-
- return array(
+ $result = array(
"url" => $request->url,
"entity" => $item->as_restful_array(),
- "members" => $members,
"relationships" => rest::relationships("item", $item));
+ if ($item->is_album()) {
+ $result["members"] = array();
+ foreach ($orm->find_all() as $child) {
+ $result["members"][] = rest::url("item", $child);
+ }
+ }
+
+ return $result;
}
static function put($request) {