Pennebaker / craftcms-thearchitect

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

entryType models in different spots overwrite previous models #16

Closed Emkaytoo closed 8 years ago

Emkaytoo commented 8 years ago

Having an issue when using the same model in multiple sections.

Steps to recreate:

  1. Take a content model and duplicate it
  2. Change the sectionHandle to the new section

Result: the second model will overwrite the first instead of adding it to the new section (which used to function properly).

This is the code I'm using:

{
  "fields": [
    {
      "group": "Content Builder",
      "name": "Section label",
      "handle": "sectionLabel",
      "instructions": "If completed, the section label will be prepended to the Title for each section. ",
      "type": "PlainText",
      "typesettings": {
        "placeholder": "",
        "maxLength": 30,
        "multiline": false
      }
    },
    {
      "group": "Content Builder",
      "name": "Block label",
      "handle": "blockLabel",
      "instructions": "If completed, the block label will be prepended to the Title for each block. ",
      "type": "PlainText",
      "typesettings": {
        "placeholder": "",
        "maxLength": 30,
        "multiline": false
      }
    },
    {
      "group": "Content Builder",
      "name": "Zebra Stripes",
      "handle": "zebraStripes",
      "instructions": "Do the subsections of this block alternate background colors?",
      "type": "Lightswitch",
      "typesettings": {
          "default": false
      }
    },
    {
      "group": "Content Builder",
      "name": "Sidenav Page Builder",
      "handle": "sidenavPageBuilder",
      "instructions": "Use this to build out your long-form pages with side navigation.",
      "required": false,
      "type": "Neo",
      "typesettings": {
        "maxBlocks": null,
        "groups": {
          "name": [],
          "sortOrder": []
        },
        "blockTypes": {
          "new0": {
            "sortOrder": 1,
            "name": "Section",
            "handle": "neoSection",
            "maxBlocks": null,
            "childBlocks": [
              "block"
            ],
            "topLevel": 1,
            "fieldLayout": {
              "Block Settings": [
                "blockLabel",
                "headline"
              ],
              "Section Settings": [
                "sectionLabel",
                "zebraStripes"
              ]
            }
          },
          "new1": {
            "sortOrder": 2,
            "name": "Block",
            "handle": "block",
            "maxBlocks": null,
            "childBlocks": "",
            "topLevel": 0,
            "fieldLayout": {
              "Content": [
                "headline",
                "columnCopy"
              ]
            }
          }
        }
      }
    }
  ],
  "entryTypes":[
    {
      "sectionHandle": "membership",
      "hasTitleField": true,
      "titleFormat": "{section.name|raw}",
      "name": "Side Nav Page",
      "handle": "sideNavPage",
      "titleLabel": "Title",
      "fieldLayout": {
        "Header Content": [
          "bannerImg",
          "bannerButton",
          "bannerHeadline",
          "introCopy"
        ],
        "Body Content": [
          "sidenavPageBuilder",
          "sponsors"
        ],
        "Menus": [
          "showInTopMenus",
          "topMenuLabel",
          "showSubnav",
          "showInBottomMenus",
          "bottomMenuLabel"
        ]
      }
    },
    {
      "sectionHandle": "lanternAwards",
      "hasTitleField": true,
      "titleFormat": "{section.name|raw}",
      "name": "Side Nav Page",
      "handle": "sideNavPage",
      "titleLabel": "Title",
      "fieldLayout": {
        "Header Content": [
          "bannerImg",
          "bannerButton",
          "bannerHeadline",
          "introCopy"
        ],
        "Body Content": [
          "sidenavPageBuilder",
          "sponsors"
        ],
        "Menus": [
          "showInTopMenus",
          "topMenuLabel",
          "showSubnav",
          "showInBottomMenus"
        ]
      }
    }
  ]
}

The lanternAwards model doesn't appear in the section. Instead the membership model has its fields overwritten.