☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

allowed_values

Table of contents

Description:

This key defines a list of valid values for the parser.

If specified, values not in the provided list will cause this snippet to be skipped, and a different snippet will be matched if possible. A user entering a different value while editing this snippet will cause it to error, so this option is best paired with a select input configured on the editor_key.

Appears in:
└── Snippet Model
    └── allowed_values
Type:
Array<unknown>
Items:
unknownunknown#
Examples:
Copied to clipboard
parser: argument
options:
  model:
    editor_key: video_id
    allowed_values:
      - riXoAr6gO-E
      - CZcNgDN81Sw
      - 0iwNjcFIHNM
{
  "parser": "argument",
  "options": {
    "model": {
      "editor_key": "video_id",
      "allowed_values": [
        "riXoAr6gO-E",
        "CZcNgDN81Sw",
        "0iwNjcFIHNM"
      ]
    }
  }
}

Example usage:

Markdown
Copied to clipboard
## My blog post

<<video "CZcNgDN81Sw">> 

<<video "riXoAr6gO-E">> 

<<video "RuvMHkfOpvg">> 

Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
These IDs match a value in `allowed_values`, thus will be shown as a `video` snippet
This ID is not present in `allowed_values` and will not parse as a `video` snippet. It may still parse as another snippet, or will remain as plain text.
Open in a new tab