I want to create an iFrame kirbytag that takes a caption however I cannot get it to work the text is kirbytext is output in a <p></p>
tag.
<?php
kirbytext::$tags['iframe'] = array(
'attr' => array(
'height',
'caption'
),
'html' => function($tag) {
$url = $tag->attr('iframe');
$height = $tag->attr('height', '100px');
$caption = $tag->attr('caption');
if(!empty($caption)) {
$figurecaption = '<figcaption>' . escape::html($caption) . '</figcaption>';
} else {
$figcaption = null;
}
return '<figure><iframe style="width:100%; height:' . $height . '" src="' . $url . '"></iframe>' . $figcaption . '</figure>';
}
);
In my kirbytext I added:
(iframe: https://framer.cloud/Rxxx/ height:600px caption:Testing)
It works fine without the caption but not with. Any help would be greatly appreciated.