Skip to content

Commit

Permalink
Fixes issue with response tag
Browse files Browse the repository at this point in the history
When not a multi dimensional array, would still cast to a 'response' tag for looping
  • Loading branch information
Alec Ritson committed May 26, 2016
1 parent f86e6c4 commit f9dcdde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Placid/PlacidTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public function request($something = null)
{
// Try and get a cached response
$cached_response = $this->cache->get($cacheId);

if($cached_response)
{
return $cached_response;
Expand All @@ -108,6 +107,7 @@ public function request($something = null)
$response = null;
}


// Do we need to cache the request?
if($options['cache']) {
$this->cache->put($cacheId, $response, $cacheDuration);
Expand All @@ -116,10 +116,12 @@ public function request($something = null)
if(!$response) {
return ['no_results' => true];
}
elseif(is_array($response))

if (count($response) == count($response, COUNT_RECURSIVE))
{
return ['response' => $response];
return $response;
}
return json_decode($response->getBody(), true);

return ['response' => $response];
}
}
2 changes: 1 addition & 1 deletion Placid/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Placid
version: 2.0.2
version: 2.0.3
description: Consume REST services in your templates
url: https://github.com/alecritson/Placid-Statamic
developer: Alec Ritson
Expand Down

0 comments on commit f9dcdde

Please sign in to comment.