Pennebaker / craftcms-thearchitect

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

[bug-report] Section import fails when `hasUrls` is false #28

Closed tomdavies closed 7 years ago

tomdavies commented 7 years ago

Hey,

Thanks for releasing The Architect - we're finding it super useful. I have hit a bug in the latest release though.

When I try to import a new section where entries do not have URLs, I get the following error:

LOCALEERRORS At least one locale must be selected for the section.

Here's a reduced test case:

{
    "sections": [
        {
            "name": "test section",
            "handle": "testSection",
            "type": "channel",
            "enableVersioning": 0,
            "typesettings": {
                "hasUrls": 0,
                "template": null,
                "urlFormat": null,
                "nestedUrlFormat": null
            }
        }
    ],
    "entryTypes": [
        {
            "sectionHandle": "testSection",
            "hasTitleField": 1,
            "titleLabel": "Title",
            "name": "test section",
            "handle": "testSection",
            "fieldLayout": []
        }
    ]
}

Whereas this works fine:


{
    "sections": [
        {
            "name": "test section",
            "handle": "testSection",
            "type": "channel",
            "enableVersioning": 0,
            "typesettings": {
                "hasUrls": 1,
                "template": "test-section\/_entry",
                "urlFormat": "test-section\/{slug}",
                "nestedUrlFormat": null
            }
        }
    ],
    "entryTypes": [
        {
            "sectionHandle": "testSection",
            "hasTitleField": 1,
            "titleLabel": "Title",
            "name": "test section",
            "handle": "testSection",
            "fieldLayout": []
        }
    ]
}

I'm running v. 1.5.4.1 of the plugin on Craft 2.6.2949 with a single default locale (no i18n).

Not certain but seems likely to be related to a0658a017c89e54938f3378596ceecda930a86ac.

spAnser commented 7 years ago

I think I have run into this before. It keeps popping back up :( Will look when I get a chance.

spAnser commented 7 years ago

v1.5.5 is ready for release today. See the wiki on Sections for the new json format when hasUrls = false

tomdavies commented 7 years ago

@spAnser sweet, thanks for the quick fix!