Hello,
I am currently building a new website using Kirby 5. I want to create a custom block needed for a blog post blueprint in the panel where I want to allow the user to embed instagram reels.
However I created a new block type inside the blueprint
The following code is in site/blueprints/pages(/beitrag.yml)
post_content:
label:
de: Inhalt
en: Content
type: blocks
pretty: true
fieldsets:
- code
- gallery
- heading
- image
- line
- list
- markdown
- quote
- table
- text
- video
- type: embed_instagram
name: Instagram
icon: instagram
preview: fields
wysiwyg: true
fields:
post_embed_link:
type: url
post_embed_alt:
type: text
Following this I have created the “embed_instagram” file (path: site/snippets/blocks(/embed_instagram.php)
<?php
#echo("Test Output");
echo($block->post_embed_link()->toEmbed()->code());
?>
If uncommented the Testutput works but if I try to render my block I receive the following error:
Block error: "Call to a member function code() on null" in block type: "embed_instagram"
It seems like the plugin is not callable inside the blocks structure and I didn’t find any useful reference for me (maybe I overlooked something?)
I try to integrate the (kirby-embed plugin it has integration for the normal fields and standard frontend useage.
Just try to import the index.php file doesn’t work for me (require(‘path to file’))
Does anybody know how to get this working? ^^
Thank you in advance ^^
j54j6