Skip to content
  1. Extras
  2. PageBuilder
  3. Field types
  4. Pro
  5. snippet

Field snippet

Version: Pro.

Why this type

Snippet picker for [[!{$snippet.name}]]. Pro dynamic processor hook in section. Separates snippet call from chunk include.

When to use

  • Section delegates render to snippet
  • Editor picks from allowed snippets list
  • Wrapper around legacy MODX snippet

Tips

Partial template include is chunk. Snippet params are separate fields or static in chunk.

Similar types

  • chunk for Fenom include
  • combo optionsSource modSnippet

Schema

json
{
  "name": "snippet",
  "type": "snippet",
  "label": "Snippet",
  "tab": "Content",
  "width": 100,
  "active": true
}

Value

Object { name }.

Section data

Key snippet in the section data:

json
{
  "snippet": {
    "name": "pbHero"
  }
}

Chunk example

html
[[!{$snippet.name}]]

Common properties

For fields with name that are stored in the section data:

KeyTypeRoleCMP
tabstringGroup subtitle in the inspectoryes
width25–100Field width as % of the row (flex)yes
descriptionstringHint under the labelyes
defaultanyInitial value for a new sectionyes
activeboolfalse hides the field in the inspectoryes
requiredboolRequired on publish (draft still saves)yes

See fields overview.

See also