Skip to content

Commit

Permalink
Handle "results" from Drupal 8.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkeppner committed Dec 27, 2018
1 parent 6cd5392 commit b797072
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ContentCache/ContentCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ protected function getContent($name = '')

$response = Guzzle::get( $profile->getEndpoint(), ['query' => $profile->getQuery()] );

$collection = collect(json_decode($response->getBody()))
$result = json_decode($response->getBody());
if (is_object($result) && property_exists($result, 'results') && is_array($result->results)) {
$result = $result->results;
}

$collection = collect($result)
->keyBy($key_by)
->transform(function ($item, $key) {
return new Item($item);
Expand Down

0 comments on commit b797072

Please sign in to comment.