You are here

protected function JsonapiParse::resolveRelationshipData in JSON:API Include 8

Resolve data.

Parameters

array|mixed $links: The data for resolve.

Return value

array Result.

1 call to JsonapiParse::resolveRelationshipData()
JsonapiParse::resolveRelationships in src/JsonapiParse.php
Resolve relationships.

File

src/JsonapiParse.php, line 153

Class

JsonapiParse
Class JsonapiParse.

Namespace

Drupal\jsonapi_include

Code

protected function resolveRelationshipData($links) {
  if (empty($links['data'])) {
    return $links;
  }
  $output = [];
  if (!$this
    ->isAssoc($links['data'])) {
    foreach ($links['data'] as $item) {
      $output[] = $this
        ->resolveData($item);
    }
  }
  else {
    $output = $this
      ->resolveData($links['data']);
  }
  return $output;
}