Skip to content

Commit

Permalink
Change the image block rest handler to expect the type (i.e. random) …
Browse files Browse the repository at this point in the history
…as a parameter not part of the path.
  • Loading branch information
Tim Almdal committed Dec 24, 2009
1 parent cf6de01 commit a2a3741
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/image_block/helpers/image_block_rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
class image_block_rest_Core {
static function get($request) {
$path = implode("/", $request->arguments);
switch ($path) {
$type = empty($request->type) ? "random" : $request->type;
switch ($type) {
case "random":
$random = ((float)mt_rand()) / (float)mt_getrandmax();

Expand All @@ -42,7 +42,7 @@ static function get($request) {
}
break;
default:
return rest::fail("Unsupported block type: '{$path}'");
return rest::fail("Unsupported image block type: '{$type}'");
}

if ($items->count() > 0) {
Expand Down

0 comments on commit a2a3741

Please sign in to comment.