function ConfigEntityDenormalizer::prepareInput

Same name in other branches
  1. 9 core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php \Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer::prepareInput()
  2. 8.9.x core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php \Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer::prepareInput()
  3. 11.x core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php \Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer::prepareInput()

Overrides EntityDenormalizerBase::prepareInput

File

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.