YAML Fields

Categories

Component ID

1215252

Component name

YAML Fields

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

The YAML Fields module allows module developers to specify node types,
fields, and field instances in a YAML file, rather than having to construct
them programatically.

To implement a YAML field specification, specify YAML Fields as a requirement in your module. Place a YAML file with your field
specifications in your module's directory as modulename.fields.yml

You can find the YAML specification at http://www.yaml.org/spec/1.2/spec.html

Here is a sample YAML field specification for a module called greenstone:

fields:
  greenstone_metadata_name:
    type: text
    entity_types: [node]
    cardinality: 1
    translatable: 0
    locked: 1
    active: 1
    deleted: 0
    settings:
      max_length: 255
      
  greenstone_metadata_value:
    type: text_long
    entity_types: [node]
    cardinality: FIELD_CARDINALITY_UNLIMITED
    translatable: 1
    locked: 0
    active: 1
    deleted: 0
    settings: {}

node_types:
  greenstone_metadata_element:
    name: Greenstone metadata element
    base: node_content
    has_title: 1
    locked: 1
    disabled: 0
    fields:
      greenstone_metadata_name:
        label: Name
        description: Name of the metadata element
        required: 1
        widget:
          type: text_textfield
      greenstone_metadata_value:
        label: Value
        description: Value of the metadata element
        required: 1
        widget:
          type: text_textfield