Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Better support for using block fields in block fields #366

Closed
estruyf opened this issue Jun 29, 2022 · 1 comment
Closed

Enhancement: Better support for using block fields in block fields #366

estruyf opened this issue Jun 29, 2022 · 1 comment
Labels
enhancement New feature or request Project: v8.0.0

Comments

@estruyf
Copy link
Owner

estruyf commented Jun 29, 2022

Currently, it is not possible to create the following structure:

ingredients:
  - wet:
    - water:
    	quantity: 1
    	unit: cup
  - dry:
    - flour:
    	quantity: 10
    	unit: oz
@estruyf estruyf added the enhancement New feature or request label Jun 29, 2022
@estruyf
Copy link
Owner Author

estruyf commented Jun 29, 2022

In order to support this, changes have been made to the block renderer.

image

The field configuration looks as follows:

{
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "Recipe",
      "pageBundle": false,
      "previewPath": null,
      "fields": [
        {
          "title": "Ingredients",
          "name": "ingredients",
          "type": "block",
          "fieldGroup": ["wet", "dry"]
        }
      ]
    }
  ],
  "frontMatter.taxonomy.fieldGroups": [
    {
      "id": "wet",
      "fields": [
        {
          "title": "Wet",
          "name": "wet",
          "type": "block",
          "fieldGroup": ["water", "oil"]
        }
      ]
    },
    {
      "id": "water",
      "fields": [
        {
          "title": "Water",
          "name": "water",
          "type": "fields",
          "fields": [
            {
              "title": "Quantity",
              "name": "quantity",
              "type": "string",
              "single": true
            },
            {
              "title": "Unit",
              "name": "unit",
              "type": "string",
              "single": true
            }
          ]
        }
      ]
    },
    ...
  ]
}

Output looks as follows in front matter:

ingredients:
  - wet:
      - water:
          quantity: "123"
          unit: Cups
        fieldGroup: water
    fieldGroup: wet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Project: v8.0.0
Projects
None yet
Development

No branches or pull requests

1 participant