Pennebaker / craftcms-thearchitect

CraftCMS plugin to generate content models from JSON data.
MIT License
171 stars 9 forks source link

Category fields don't properly link with a category group on construction. #32

Closed timknight closed 7 years ago

timknight commented 7 years ago

Allowing category groups to be exported was something added within issue/enhancement #14. I'm noticing while category group are now exported within the JSON, during construction there seems to still be an issue.

So within the JSON I have a category statement:

"categories": [
    {
        "name": "Blog",
        "handle": "blogCategories",
        "hasUrls": 1,
        "template": "blog\/category",
        "maxLevels": null,
        "locales": {
            "en_us": {
                "urlFormat": "blog\/category\/{slug}",
                "nestedUrlFormat": "{parent.uri}\/{slug}"
            }
        },
        "fieldLayout": []
    }
]

And then a new field:

"fields": [
    {
        "group": "Default",
        "name": "Blog Category",
        "handle": "blogCategory",
        "instructions": "",
        "required": false,
        "type": "Categories",
        "typesettings": {
            "source": "blogCategories",
            "limit": "",
            "selectionLabel": "Add blog category"
        }
    }
]

Everything will construct without an error. However going into the entry that was assigned this field during construction you're given the error This field is not set to a valid category group.

I edit the field where the correct category group is already selected, make no changes, and just press save. The error is then corrected and the field is linked correctly.