Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug] Imagefield with attrib breaks repeaters #5652

Closed
SvanteRichter opened this issue Aug 7, 2016 · 4 comments
Closed

[Bug] Imagefield with attrib breaks repeaters #5652

SvanteRichter opened this issue Aug 7, 2016 · 4 comments
Assignees
Labels
bug A bug that has been verified

Comments

@SvanteRichter
Copy link
Contributor

SvanteRichter commented Aug 7, 2016

Tested on 3.0.11 and master.

The image fields attribute fields do not seem to get the right name/key when the save is done. This does not happen on other fields that post multiple values like the geolocation field. The effect of this seems to be that only the last repeater in the set seems to be saved/shown on refresh.

Looking at the posted data in devtools shows the following for the repeater (the image field was left empty on save):

templatefields[slides][0][image][file]:
templatefields[slides]_#_image[title]:
templatefields[slides]_#_image[alt]:
templatefields[slides][0][teaser_text]:<p>test1</p>

Here is the templatefields config I tested with:

templatefields:
    extrafields.twig:
        section_1:
            type: text
            label: Section 1
        section_2:
            type: html
            label: Section 2
        image:
            type: image
            attrib: [title, alt]
            extensions: [ gif, jpg, png ]
            label: Image
        slides:
            type: repeater
            fields:
                image:
                    type: image
                    extensions: [ gif, jpg, png ]
                    label: Image
                teaser_text:
                    type: html
                    height: 300px
                    label: Teaser Text
@SvanteRichter SvanteRichter changed the title Imagefield with attrib breaks repeaters in templatefields [Bug] Imagefield with attrib breaks repeaters in templatefields Aug 7, 2016
@SvanteRichter SvanteRichter added the bug A bug that has been verified label Aug 7, 2016
@rossriley
Copy link
Contributor

Looks like it's time for my favourite activity, debugging js.

@rossriley rossriley self-assigned this Aug 7, 2016
@SvanteRichter
Copy link
Contributor Author

SvanteRichter commented Aug 7, 2016

@rossriley I actually thought I'd have a look at this later today or tomorrow. So, if you want to take a look at the hydration on the frontend instead (if you have time), we can split the work that way.

(And I should probably have self-assigned it when I posted it...)

@rossriley
Copy link
Contributor

rossriley commented Aug 7, 2016

cool, well the answer will be in the renumber method inside the fieldRepeater.js file. That's what turns the # into a properly indexed number.

@SvanteRichter SvanteRichter changed the title [Bug] Imagefield with attrib breaks repeaters in templatefields [Bug] Imagefield with attrib breaks repeaters Aug 10, 2016
@SvanteRichter
Copy link
Contributor Author

This was actually an issue in all repeaters, not just templatefields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that has been verified
Projects
None yet
Development

No branches or pull requests

2 participants