contentful / rich-text.php

Utilities for the Contentful Rich Text
https://www.contentful.com
MIT License
12 stars 9 forks source link

Rich Text parse Linked Resource without locale specification #65

Closed lamasfoker closed 1 year ago

lamasfoker commented 1 year ago

Steps to reproduce

  1. Create a Contentful Space with 2 locales: English (default) and Italian;
  2. Create an Entry Model "Blog Post" with a Body field of type Rich Text;
  3. Create a "Blog Post" Entry with an Image in the Body field, the same image for the English and Italian Body fields;
  4. The Image Asset has both title and description filled in both languages;
  5. Try to render the Blog Post Entry in the not default language (Italian)

Expected Result

The title of the image present in the Body of the Blog Post should be in Italian

Actual Result

The title of the image present in the Body of the Blog Post is in English

Considerations

The issue is in the use of the \Contentful\Core\Api\LinkResolverInterface Interface. The Mappers should pass also the locale code in the second argument $parameters. The Mappers that use this interface are:

  1. \Contentful\RichText\NodeMapper\AssetHyperlink
  2. \Contentful\RichText\NodeMapper\EmbeddedAssetBlock
  3. \Contentful\RichText\NodeMapper\EmbeddedAssetInline
  4. \Contentful\RichText\NodeMapper\Reference\EntryReference
Sebb767 commented 1 year ago

This is resolved with v4.0.0 :)