You are here

protected function ConfigEntityDenormalizer::prepareInput in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php \Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer::prepareInput()
  2. 10 core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php \Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer::prepareInput()

Prepares the input data to create the entity.

Parameters

array $data: The input data to modify.

\Drupal\jsonapi\ResourceType\ResourceType $resource_type: Contains the info about the resource type.

string $format: Format the given data was extracted from.

array $context: Options available to the denormalizer.

Return value

array The modified input data.

Overrides EntityDenormalizerBase::prepareInput

File

core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php, line 27

Class

ConfigEntityDenormalizer
Converts the Drupal config entity object to a JSON:API array structure.

Namespace

Drupal\jsonapi\Normalizer

Code

protected function prepareInput(array $data, ResourceType $resource_type, $format, array $context) {
  $prepared = [];
  foreach ($data as $key => $value) {
    $prepared[$resource_type
      ->getInternalName($key)] = $value;
  }
  return $prepared;
}