function StringNormalizer::normalize
Overrides ComplexDataNormalizer::normalize
File
-
core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_field_type/ src/ Normalizer/ StringNormalizer.php, line 22
Class
- StringNormalizer
- Normalizes string fields weirdly: replaces 'super' with 'NOT' and vice versa.
Namespace
Drupal\jsonapi_test_field_type\NormalizerCode
public function normalize($object, $format = NULL, array $context = []) {
$data = parent::normalize($object, $format, $context);
$data['value'] = str_replace('super', 'NOT', $data['value']);
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.