You are here

protected function ConfigEntityDenormalizer::prepareInput in JSON:API Extras 8.3

1 call to ConfigEntityDenormalizer::prepareInput()
ConfigEntityDenormalizer::denormalize in src/Normalizer/ConfigEntityDenormalizer.php
Denormalizes data back into an object of the given class.

File

src/Normalizer/ConfigEntityDenormalizer.php, line 22

Class

ConfigEntityDenormalizer
Override ConfigEntityNormalizer to prepare input.

Namespace

Drupal\jsonapi_extras\Normalizer

Code

protected function prepareInput(array $data, ResourceType $resource_type) {
  foreach ($data as $public_field_name => &$field_value) {

    /** @var \Drupal\jsonapi_extras\Plugin\ResourceFieldEnhancerInterface $enhancer */
    $enhancer = $resource_type
      ->getFieldEnhancer($public_field_name);
    if (!$enhancer) {
      continue;
    }
    $field_value = $enhancer
      ->transform($field_value);
  }
  return $data;
}