Pennebaker / craftcms-thearchitect

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

Channels section throws php error with hasUrls is false #39

Closed Emkaytoo closed 7 years ago

Emkaytoo commented 7 years ago

Code I used:

{
  "name": "Individual Offices",
  "handle": "office",
  "type": "structure",
  "enableVersioning": true,
  "typesettings": {
    "hasUrls": true,
    "urlFormat": "",
    "nestedUrlFormat": "",
    "template": "structure-page/_entry",
    "maxLevels": 1
    }
},

That threw an error. When I switched it to true, the section uploaded successfully.

spAnser commented 7 years ago

I think this references commit 358d970a69038022778508366f3c16d112b2d2e0

When has URLs is false The Architect was attempting to import locale data without seeing if it existed first.

{
    "sections": [
        {
            "name": "No URLs",
            "handle": "noUrls",
            "type": "channel",
            "enableVersioning": 1,
            "typesettings": {
                "hasUrls": 0,
                "template": null,
                "locales": {
                    "en_us": 1
                }
            }
        }
    ],
    "entryTypes": [
        {
            "sectionHandle": "noUrls",
            "hasTitleField": 1,
            "titleLabel": "Title",
            "name": "No URLs",
            "handle": "noUrls",
            "fieldLayout": []
        }
    ]
}
{
    "sections": [
        {
            "name": "Has URLs",
            "handle": "hasUrls",
            "type": "channel",
            "enableVersioning": 1,
            "typesettings": {
                "hasUrls": 1,
                "template": "",
                "urlFormat": "no-urls\/{slug}",
                "nestedUrlFormat": null
            }
        }
    ],
    "entryTypes": [
        {
            "sectionHandle": "hasUrls",
            "hasTitleField": 1,
            "titleLabel": "Title",
            "name": "Has URLs",
            "handle": "hasUrls",
            "fieldLayout": []
        }
    ]
}