You are here

protected function ConfigEntityNormalizer::serializeField in JSON:API 8

Serializes a given field.

Parameters

mixed $field: The field to serialize.

array $context: The normalization context.

string $format: The serialization format.

Return value

Value\FieldNormalizerValueInterface The normalized value.

Overrides EntityNormalizer::serializeField

File

src/Normalizer/ConfigEntityNormalizer.php, line 49

Class

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

Namespace

Drupal\jsonapi\Normalizer

Code

protected function serializeField($field, array $context, $format) {
  return new FieldNormalizerValue(AccessResult::allowed(), [
    new ConfigFieldItemNormalizerValue($field),
  ], 1, 'attributes');
}