Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fields of type File are incorrectly rendered inside a repeating block #88

Closed
rogierkoppejan opened this issue Sep 14, 2018 · 1 comment

Comments

@rogierkoppejan
Copy link
Contributor

rogierkoppejan commented Sep 14, 2018

When rendering a RepeatingFieldCollection, fields of type File (image, audio, etc) have an incorrect key. More specifically, the key is set to the type of field (i.e. image), while it should be the label (i.e. my_field_name). This not only results in unexpected key names, but also overwrites previous file fields in the same block because they all have the same key.

Example, given the following block:

my_block:
    type: block
    fields:
        my_fieldset:
            fields:
                first_image:
                    type: image
                second_image:
                    type: image

This will be rendered as:

{
  "my_block": [
    {
      "image": {
        "file": "images/filename.jpg",
        "url": "http://hostname.com/files/",
        "thumbnail": "http://hostname.com/thumbs/400x300/images/filename.jpg"
      },
      "_block": "my_fieldset"
    }
  ]
}
@rogierkoppejan rogierkoppejan changed the title Fields of type File are incorrectly rendered inside a block (repeater) Fields of type File are incorrectly rendered inside a block (repeater) Sep 17, 2018
@rogierkoppejan rogierkoppejan changed the title Fields of type File are incorrectly rendered inside a block (repeater) Fields of type File are incorrectly rendered inside a repeating block Sep 17, 2018
@xiaohutai
Copy link
Owner

Fixed via #89

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants