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

Add console controller action to enable importing yaml via cli #34

Closed phoban01 closed 5 years ago

phoban01 commented 5 years ago

Small update to console/controllers/ImportController.php that reads a YAML file, converts to JSON and hits the import service.

spAnser commented 5 years ago

Do you have an example yaml file for this feature?

phoban01 commented 5 years ago

How about this:


volumes:
  - name: Uploads
    handle: uploads
    type: Local
    hasUrls: true
    url: "/uploads"
    settings:
      path: "uploads/"
    fieldLayout: {}

fieldGroups:
  - Blog

fields:
  - name: Hero Image
    handle: hero
    type: Assets 
    group: Blog
    useSingleFolder: true
    defaultUploadLocationSource: "*"
    defaultUploadLocationSubpath: "blog/"
    singleUploadLocationSource: "*"
    singleUploadLocationSubpath: "blog/"
    restrictFiles: true
    limit: 1
    allowedKinds:
      - image
    sources: "*"
  - name: Caption
    handle: caption
    group: Blog
    type: PlainText
  - name: Body
    handle: body
    group: Blog
    type: PlainText
    typesettings:
      multiline: true

sections:
  - name: Blog
    handle: blog
    type: channel
    siteSettings:
      - hasUrls: true
        uriFormat: "blog/{slug}"
        template: "templates/blog/_index.twig"

entryTypes:
  - name: Blog
    handle: blog
    sectionHandle: blog
    hasTitleField: true
    titleLabel: Title
    fieldLayout:
      Content:
        - hero
        - caption
        - body
spAnser commented 5 years ago

Looks good.