Skip to content

Instantly share code, notes, and snippets.

@vijaycs85
Last active December 16, 2015 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijaycs85/5433410 to your computer and use it in GitHub Desktop.
Save vijaycs85/5433410 to your computer and use it in GitHub Desktop.
# field.instance.node.article.body.yml
default_value:
-
summary: ''
value: "<p>default 1</p>\r\n"
format: basic_html
field_type: text_with_summary
-
summary: ''
value: "<p>default 2</p>\r\n"
format: basic_html
field_type: text_with_summary
# Field instance defintion holds the top 'sequence' part.
# field.schema.yml
field.instance.*.*.*:
type: mapping
label: 'Field instance'
mapping:
default_value:
type: sequence
label: 'Default value'
sequence:
- type: field.[field_type].value
# Just type specific elements in data type defintion
# text.scheam.yml
field.text_with_summary.value:
type: mapping
label: 'Default'
mapping:
summary:
type: string
label: 'Summary'
value:
type: text
label: 'Body'
format:
type: string
label: 'Text format'
field_type:
type: string
label: 'Field type'
@vijaycs85
Copy link
Author

This way, we can have field.instance...*

field.instance.*.*.*:
  type: mapping
  label: 'Field instance'
  mapping:
    default_value:
      type: sequence
      label: 'Default value'
      sequence:
        - type: field.[field_type].value

and data type as

field.text_with_summary.value:
  type: mapping
  label: 'Default'
  mapping:
    summary:
      type: string
      label: 'Summary'
    value:
      type: text
      label: 'Body'
    format:
      type: string
      label: 'Text format'
    field_type:
      type: string
      label: 'Field type'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment