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

Fieldtype „block“ contains wrong content #79

Closed
binarykiwi opened this issue Apr 11, 2018 · 1 comment
Closed

Fieldtype „block“ contains wrong content #79

binarykiwi opened this issue Apr 11, 2018 · 1 comment

Comments

@binarykiwi
Copy link

I defined a contenttype using the 'block' fieldtype like this one:

test:
    name: Test
    singular_name: Test
    singular_slug: test
    fields:
        title:
            label: Global Heading
            type: text
        description:
            label: Global Text
            type: html
        blocks:
            label: Content Elements
            type: block
            fields:
                titlesection:
                    label: Title Section
                    fields:
                        heading:
                            type: text
                textsection:
                    label: Text Section
                    fields:
                        heading:
                            type: text
                        description:
                            type: textarea
                videosection:
                    label: Video Section
                    fields:
                        heading:
                            type: text
                        video:
                            type: video

Now, entering some test content and calling /json/test/1 gives this result:

{
    "links": {
        "self": "http:\/\/test.local\/json\/test\/1"
    },
    "data": {
        "id": "1",
        "type": "test",
        "attributes": {
            "datechanged": "2018-04-11T16:58:58+02:00",
            "title": "Global Heading",
            "description": "<p>Global Text<\/p>\r\n",
            "blocks": [
                {
                    "heading": "Title Section Heading",
                    "_block": "titlesection"
                },
                {
                    "heading": "",
                    "_block": "textsection",
                    "description": "Text Description with no defined heading."
                },
                {
                    "heading": "Video Section Heading",
                    "_block": "videosection",
                    "description": "Text Description with no defined heading.",
                    "video": {
                        "url": "",
                        "width": "",
                        "height": "",
                        "title": "",
                        "authorname": "",
                        "ratio": "",
                        "authorurl": "",
                        "html": "",
                        "thumbnail": ""
                    }
                },
                {
                    "heading": "",
                    "_block": "textsection",
                    "description": "see what happpens",
                    "video": {
                        "url": "",
                        "width": "",
                        "height": "",
                        "title": "",
                        "authorname": "",
                        "ratio": "",
                        "authorurl": "",
                        "html": "",
                        "thumbnail": ""
                    }
                }
            ]
        },
        "links": {
            "self": "http:\/\/test.local\/json\/test\/1"
        }
    }
}

Look at the result. If a block does not contain an element of the previous block the content of the previous block shows up in its successor. Eg. the textsection has no field video but in the json there is one - or the videosection has no field description but in the json there is one...

I guess this might be a bug and should be fixed.

Raistlfiren added a commit to Raistlfiren/jsonapi that referenced this issue Apr 19, 2018
xiaohutai added a commit that referenced this issue Apr 20, 2018
@xiaohutai
Copy link
Owner

Just made a release. Fixed in v3.0.18

# 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