In https://www.drupal.org/project/jsonapi_extras/issues/3048341 the context was not passed correctly in ResourceIdentifierNormalizer.
But a similar issue also occurs within FieldItemNormalizer.

Enhancers on field level do not know anything about the context right now. Which could be easily resolved by passing the available context to undoTransform.

Another improvement on that would also be to add the $object (FieldItem) to the context to inform the enhancer through the context which fielditem is being enhanced.

Comments

jefuri created an issue. See original summary.

jefuri’s picture

Status: Active » Needs review
StatusFileSize
new1.09 KB
jefuri’s picture

StatusFileSize
new1.09 KB
jefuri’s picture

I noticed that entity references do not pass the field item object yet, this might be "important" information a developer would want in their enhancer.

jefuri’s picture

For the resource identifier normalizer, there is no "field item" passed. Only the resource identifier for the entity reference. So I renamed it from field_item_object to field_item_resource_identifier.

e0ipso’s picture

Thanks for contributing @jefuri! This module is better and more useful thanks to you. Open source maintainers need contributions to keep up. ❤️
e0ipso’s picture

Status: Needs review » Fixed

  • e0ipso committed ea197cc on 8.x-3.x authored by jefuri
    Issue #3062259 by jefuri, e0ipso: Pass context in FieldItemNormalizer
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.