Pennebaker / craft-architect

A plugin for importing and exporting content models from Craft 3/4 using JSON.
MIT License
72 stars 6 forks source link

GlobalSet failed to create...maybe #14

Closed Emkaytoo closed 6 years ago

Emkaytoo commented 6 years ago

Steps to recreate:

  1. Attempted to import the json below, and received the error in the image below.

    error-globalset
  2. Checked sidebar for globals menu, no menu appeared.

  3. Attempted to recreate the globalSet manually in the CP using the same name and handle.

  4. On save, received error that Name/Handle has already been taken.

  5. Globals menu suddenly appears in the sidebar.

The json is below.


{
  "fieldGroups": [
    "Globals"
  ],
  "categoryGroups": [
    {
      "name": "Article Type",
      "handle": "articleType",
      "maxLevels": 1,
      "siteSettings": [
        {
          "uriFormat": "articles/{slug}",
          "template": ""
        }
      ],
      "fieldLayout": {
        "Properties": []
      },
      "requiredFields": []
    }
  ],
  "sections": [
    {
      "name": "Articles",
      "handle": "articles",
      "type": "channel",
      "enableVersioning": 1,
      "siteSettings": [
        {
          "hasUrls": true,
          "uriFormat": "{articleCategory.one().slug}/{slug}",
          "template": "",
          "enabledByDefault": 1
        }
      ]
    },
    {
      "name": "Events",
      "handle": "events",
      "type": "channel",
      "enableVersioning": 1,
      "siteSettings": [
        {
          "hasUrls": false,
          "uriFormat": "",
          "template": "",
          "enabledByDefault": 1
        }
      ]
    }
  ],
  "fields": [
    {
      "group": "Resources",
      "name": "Article Category",
      "handle": "articleCategory",
      "instructions": "Select the category that describes the type of article this is.",
      "type": "craft\\fields\\Categories",
      "source": "articleType",
      "branchLimit": 1,
      "selectionLabel": "Select a category"
    },
    {
      "group": "Page Content",
      "name": "Article Builder",
      "handle": "articleBuilder",
      "instructions": "",
      "type": "craft\\fields\\Matrix",
      "minBlocks": "",
      "maxBlocks": "",
      "localizeBlocks": false,
      "blockTypes": []
    },
    {
      "group": "Page Content",
      "name": "Article Short Name",
      "handle": "articleShortName",
      "instructions": "If appropriate, give this article a shorter title. This will be used on landing pages instead of the full title.",
      "type": "craft\\fields\\PlainText",
      "placeholder": "",
      "charLimit": 70,
      "multiline": false,
      "columnType": "string"
    },
    {
      "group": "Page Content",
      "name": "Event Description",
      "handle": "eventDescription",
      "instructions": "Write a description for this event, up to 200 characters.",
      "type": "craft\\fields\\PlainText",
      "placeholder": "",
      "charLimit": 200,
      "multiline": false,
      "columnType": "string"
    },
    {
      "group": "Page Content",
      "name": "Event Date",
      "handle": "eventDate",
      "instructions": "When does this event start?",
      "type": "craft\\fields\\Date",
      "dateTime": "showBoth",
      "minuteIncrement": 15
    },
    {
      "group": "Globals",
      "name": "News Boilerplate",
      "handle": "newsBoilerplate",
      "instructions": "This is the boilerplate copy that appears in the news section and on some articles.",
      "type": "craft\\redactor\\Field",
      "translationMethod": "language",
      "translationKeyFormat": null,
      "redactorConfig": "Simple.json",
      "availableVolumes": [],
      "availableTransforms": [],
      "cleanupHtml": true,
      "purifyHtml": true,
      "purifierConfig": null,
      "columnType": "text"
    },
    {
      "group": "Globals",
      "name": "Cookie Boilerplate",
      "handle": "cookieBoilerplate",
      "instructions": "This is the boilerplate copy that appears in the website cookie alert box.",
      "type": "craft\\redactor\\Field",
      "translationMethod": "language",
      "translationKeyFormat": null,
      "redactorConfig": "Simple.json",
      "availableVolumes": [],
      "availableTransforms": [],
      "cleanupHtml": true,
      "purifyHtml": true,
      "purifierConfig": null,
      "columnType": "text"
    }
  ],
  "entryTypes": [
    {
      "sectionHandle": "articles",
      "hasTitleField": 1,
      "titleLabel": "Article Name",
      "titleFormat": "",
      "name": "Page Article",
      "handle": "pageArticle",
      "fieldLayout": {
        "Content": [
          "articleShortName",
          "articleBuilder",
          "externalLinkUrl"
        ],
        "Tags": [
          "articleCategory",
          "relatedBrands"
        ]
      },
      "requiredFields": [
        "articleBuilder",
        "articleCategory",
        "relatedBrands"
      ]
    },
    {
      "sectionHandle": "articles",
      "hasTitleField": 1,
      "titleLabel": "Article Name",
      "titleFormat": "",
      "name": "PDF Article",
      "handle": "pdfArticle",
      "fieldLayout": {
        "Content": [
          "articleShortName",
          "resourceFile"
        ],
        "Tags": [
          "articleCategory",
          "relatedBrands"
        ]
      },
      "requiredFields": [
        "resourceFile",
        "articleCategory",
        "relatedBrands"
      ]
    },
    {
      "sectionHandle": "events",
      "hasTitleField": 1,
      "titleLabel": "Event Name",
      "titleFormat": "",
      "name": "Event",
      "handle": "event",
      "fieldLayout": {
        "Content": [
          "eventDate",
          "eventDescription",
          "externalLinkUrl"
        ],
        "Tags": [
          "articleCategory",
          "relatedBrands"
        ]
      },
      "requiredFields": [
        "eventDate",
        "eventDescription",
        "externalLinkUrl",
        "articleCategory",
        "relatedBrands"
      ]
    }
  ],
  "globalSets": [
    {
      "name": "Boilerplate Content",
      "handle": "boilerplateContent",
      "fieldLayout": {
        "Content": [
          "newsBoilerplate",
          "cookieBoilerplate"
        ]
      },
      "requiredFields": [
        "newsBoilerplate",
        "cookieBoilerplate"
      ]
    }
  ]
}
Emkaytoo commented 6 years ago

The rest of the model imported as expected.

Emkaytoo commented 6 years ago

Also, no globalSet was added to the database.

Emkaytoo commented 6 years ago

Ok so this is weird...

I cleared everything out and tried again, and I got the same result.

I cleared everything out and tried again, but this time didn't import the globalSet with the model above, and then afterward imported just the global set, and it successfully imported.