I have run a few tests to isolate the cause of the error.
For the test I applied a plain kit each for Kirby V3.5.8 und V3.6.2.
1/ I created minimum code files (see below) to get the test environment running.
2/ Under V3.5.8, in the panel I can insert blocks as intended and they are rendered in the frontend browser as intended.
3/ If I switch the Kirby from V3.5.8 to V3.6.2, it still renders all blocks well in the frontend (Kirby cache), but in the backend panel, if a video block has or is been created, immediately an error message is created and no more blocks can be, viewed, inserted or modified.
4/ UNUSUAL aspect: if I create a video block under V3.5.8, switch to V3.6.2 and then rename in file video.yml the field identifier “vid” to “url”, THEN the panel (V3.6.2) does not display an error anymore in V3.6.2, but works as intended (blocks can be inserted etc.). It is just the identifier “url”, I have not found yet any other field identifier wording than “url” (in video.yml), which results in the same (intended) behaviour. The frontend still renders the video (despite the “url” change), because still in the Kirby cache (I assume).
If I insert a new videoblock under V3.6.2, then the code file video.php is called again (still with the now wrong “vid” identifier) and the frontend renderings of videos fails. Changing the “->vid()” chain element to “->url()” is not an option as “url()” is a predefined keyword.
What is the reason for this behaviour? What do I do wrong? How can I achieve the intended Kirby V3.6.2 behaviour for video blocks, and avoid the error messages?
Thank you for your help.
My code files (both for V3.5.8 and V3.6.2):
(note: it’s the simplest version, e.g. if no video file is referenced in the video block, then an default.php error message is thrown in the frontend of course.)
/site/blueprint/site.yml
title: Video Block Test
type: fields
fields:
dieblocks:
type: blocks
label: Folien
fieldsets:
- image
- text
- video
/site/blueprint/blocks/video.yml
name: VideoBlockTest
icon: video
preview: video
fields:
vid:
type: files
multiple: false
/site/templates/default.php
<h1><?= $page->title() ?></h1>
<?= $site->dieblocks()->toBlocks() ?>
/site/snippets/blocks/video.php
<?php if ($block->isNotEmpty()): ?>
<figure>
<video controls autoplay id="mVideo" loop muted>
<source src="<?= $block->vid()->toFile()->url() ?>" type="video/mp4">
Your browser does not support the video tag.
</video>
</figure>
<?php else: echo "<h1>Block is empty</h1>"; ?>
<?php endif ?>