This could be a rather long issue description, so please bear with me here. ![]()
It all starts with Markdown content:
Text:
# L’allemand un jeu d’enfants
(content-box:start image:mobiklasse_team_2016-17.jpg alt:Team color:yellow)
© Jennifer Sanchez // mobiklasse.de est une campagne qui a pour but de sensibiliser des élèves à la langue et à la culture allemandes en France. (link: program text: Apprendre plus »)
(content-box:end)
## mobiklasse.de dans les régions françaises
(snippet:region-map)
The first used tag (content-box) is working but the following (snippet) not. At least while using another snippet in the content-box tag. Here‘s the content-box-snippet:
<?php
kirbytext::$tags['content-box'] = array(
'attr' => array(
'image',
'alt',
'color'
),
'html' => function($tag) {
$type = $tag->attr('content-box');
$imageUrl = $tag->attr('image');
if ($type == 'start') {
if ($tag->file($imageUrl)->exists()) {
$color = !empty($tag->attr('color')) ? ' c-content-box--' . $tag->attr('color') : '';
$html = '<div class="c-content-box' . $color . '">' .
snippet('responsive-image', array('image' => $tag->file($imageUrl), 'alt' => $tag->attr('alt')), true) .
'<div markdown="1" class="c-content-box__content">';
}
else {
$html = '(content-box): Please check the image name and availability.';
}
}
elseif ($type == 'end') {
$html = '</div></div>';
}
else {
$html = '(content-box): Please check the kirbytag syntax.';
}
return $html;
}
);
And the responsive-image snippet which (only in this context) is causing all the trouble:
<img
src="<?= $image->width(920)->url() ?>"
srcset="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
data-srcset="<?= $image->width(920)->url() ?> 920w,
<?= $image->width(600)->url() ?> 600w,
<?= $image->width(300)->url() ?> 300w"
data-sizes="auto"
class="lazyload">
Here‘s the snippet-tag:
<?php
kirbytext::$tags['snippet'] = array(
'attr' => array(),
'html' => function($tag) {
$file = $tag->attr('snippet');
return snippet($file, array(), true);
}
);
Unfortunately, the output of the snippet tag is omitted if the responsive-image snippet in the content-box tag is used.
Has anyone an idea why this happens?
Thanks a lot
René
