You are here

public function JsonapiHelper::prepareData in Entity Share 8

Uniformize JSON data in case of single value.

Parameters

array $data: The JSON data.

Return value

array An array of data.

Overrides JsonapiHelperInterface::prepareData

3 calls to JsonapiHelper::prepareData()
JsonapiHelper::buildEntitiesOptions in modules/entity_share_client/src/Service/JsonapiHelper.php
Prepare entities from an URI to request.
JsonapiHelper::importEntityListData in modules/entity_share_client/src/Service/JsonapiHelper.php
Use data from the JSONAPI to import content.
JsonapiHelper::updateRelationships in modules/entity_share_client/src/Service/JsonapiHelper.php
Create or update the entity reference field values of an entity.

File

modules/entity_share_client/src/Service/JsonapiHelper.php, line 497

Class

JsonapiHelper
Class JsonapiHelper.

Namespace

Drupal\entity_share_client\Service

Code

public function prepareData(array $data) {
  if ($this
    ->isNumericArray($data)) {
    return $data;
  }
  else {
    return [
      $data,
    ];
  }
}