You are here

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

Resolve attributes.

Parameters

array|mixed $item: The input item.

Return value

array The resolve output.

2 calls to JsonapiParse::resolveAttributes()
JsonapiParse::flattenIncluded in src/JsonapiParse.php
Flatten included.
JsonapiParse::parseResource in src/JsonapiParse.php
Parse Resource.

File

src/JsonapiParse.php, line 79

Class

JsonapiParse
Class JsonapiParse.

Namespace

Drupal\jsonapi_include

Code

protected function resolveAttributes($item) {
  $resource = $item;
  if (!empty($resource['attributes'])) {
    foreach ($resource['attributes'] as $name => $value) {
      $resource[$name] = $value;
    }
    unset($resource['attributes']);
  }
  return $resource;
}