diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-04-15 06:18:47 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-04-16 14:30:41 -0700 |
commit | a2e0472f83b7f3151c4b4ca51472d18258110561 (patch) | |
tree | 6af0834b15bbdff2b54c53e2c7ab25a1c1b9576c | |
parent | c2615e87a7ee82da9819e7a57ce2f6f9fcc6c6bb (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.php | 16 |
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) { |