I’m trying to build a custom video block based on the audio cookbook but when I try to add the attributes to the video stored in an array I get this error message: “Array to string conversion in block type”. I’m just not very fluent on php so I’m sure the mistake is the way I’m trying to pass the attributes array into the video tag. here’s my localvideo.php code:
I also would like to ask if someone could point me in what would be the best way to combine this custom block with the original video block since the idea is to be able to upload vimeo files and local files and it seems a bit redundant to use 2 different blocks for this or is it better to keep them separated?
I really appreciate your help since I’m really stuck on how to make the array work. Thank you so much!
Has support for Kirby Tags as as custom block. I decided to make a seperate block for localvideos because it was simpler. You should be able to copy the default block into your plugin and add to code to it to do what you want tho… i was just lazy
This line is the source of your error. $vidoptions is an array and you are trying to echo this array. What you’d need here is to implode() the array again to get a string, or don’t create an array in the first place.
Thank you so much for both your answers and sorry for the late reply, unfortunately the implode didn’t work because I only got the state of the boolean “true” instead of the value but I did it without the array as you suggested like this:
Now I am having difficulties merging this custom block with the default vimeo block, on my local video blueprint I added another tab for the vimeo block and it’s working but on the localvideo.php I can’t manage to figure it out how to put them together. If I only add a vimeo video it says “no video was added” it seems it only assumes the local video. here is my localvideo.php