diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-04-17 15:36:46 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-04-17 15:36:46 -0700 |
commit | 2257776f9b4c231033656db1eb23246035aa42fd (patch) | |
tree | 13b0d19a64aa0e2b5270a82eb3bd5f7a1c00be2c /modules/gallery/helpers/items_rest.php | |
parent | af71df3d0f6bbed29446df1801d16d28acbf927c (diff) |
Don't show the member element for non-collection elements in the response. Having a members sidebar element indicates to the rest clients that this is a resource collection.
Conflicts:
modules/gallery/helpers/items_rest.php
Diffstat (limited to 'modules/gallery/helpers/items_rest.php')
-rw-r--r-- | modules/gallery/helpers/items_rest.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/gallery/helpers/items_rest.php b/modules/gallery/helpers/items_rest.php index 05ca65cf..5d8e80b2 100644 --- a/modules/gallery/helpers/items_rest.php +++ b/modules/gallery/helpers/items_rest.php @@ -22,19 +22,20 @@ class items_rest_Core { $items = array(); if (isset($request->params->url)) { - foreach($request->params->url as $url) { + foreach (json_decode($request->params->url) as $url) { $item = rest::resolve($url); if (access::can("view", $item)) { - $members = array(); + $item_rest = array("url" => $url, + "entity" => $item->as_restful_array(), + "relationship" => rest::relationships("item", $item)); if ($item->type == "album") { + $members = array(); foreach ($item->children() as $child) { $members[] = rest::url("item", $child); } + $item_rest["members"] = $members; } - $items[] = array("url" => $url, - "entity" => $item->as_restful_array(), - "members" => $members, - "relationship" => rest::relationships("item", $item)); + $items[] = $item_rest; } } } |