I would like to add a video which can be managed in the backend. How do I add a video to blueprint which has already been added to the content folder? Furthermore, using PHP how do I load the video?
The easiest way would probably to use my plugin, which contains a Custom tag for textarea fields and a custom block for the new Editor field in Kirby 3.5.
If you want to do it manually, you could use the snippet from my plugin as a starting point. What you have above will work, you just need to create a files field in your bluprint and check that in your if statement instead.
See towards the bottom of that page for an example of how to use it in the template.
You don’t need a files field, a section to display the video will suffice, unless you have multiple videos and want to select only a selection of these.
But you will then need a files section to show the video in the page.
Again, if you have only one video, you can fetch it with the $page->video() method.
Brilliant thanks for the advice, I have tried to include video in my yml as i did with an image, this does not work. What is the correct way to add a video section into my blueprint?
HomeVideo:
type: files
headline: Video
max: 1
layout: cards
Because you have added a field, not a section. To mix section with fields, you need a separate section for fields, and then the files section. The documentation is your friend. There are also many example blueprints, both in the Starterkit and in the documentation.
Using this method it displays all media, I would only like to display specific videos. How do I do this?
sections:
HomeVideo:
type: files
headline: Video Home
max: 1
layout: cards
Ahh great thanks, yes that worked. The type attribute was not working correctly so I just added mp4 manually as I will not be hosting any other formats: