Video Field Type

Renders a Video Selector component inside the block.

The type we would use inside the schema’s field_meta property to render this field is “video”: "type": "video"

If you haven’t already, we suggest you read the “model.json file” and “Field Types” pages before continuing.

Minimum Schema needed to create the field

"video": {
  "type": "object",
  "field_meta": {
    "type": "video",
    "label": "Self hosted Video"
  },
  "default": {
    "src": "",
    "id": null
  }
}

This snippet of code will generate a Video Selector. The field name will be “video”, its label will be “Video” and by default, it won’t have a selected video.

What it would look like inside the block in the editor.

Video Field Type Screenshot | Theme Redone

Rendering field’s data on the front-end:

We would use the "src" property that’s present inside the “default” object.
In latte, it would look something like this.

<video 
  controls 
  src="{$video['src']|noescape}"
></video>

Additional / Optional field_meta properties

Besides the optional properties help (explained on Field Types page), and col (explained on model.json page), this field type doesn’t have its own optional properties at this point.

Join Our Newsletter

To get updates about Theme Redone