shortcode->getHandlers()->add('full-bleed', function (ShortcodeInterface $sc) { $plugin = $this->grav['plugins']->getPlugin('story-blocks'); $page = $plugin ? $plugin->getCurrentPage() : null; $imageName = htmlspecialchars($sc->getParameter('image', ''), ENT_QUOTES); $alt = htmlspecialchars($sc->getParameter('alt', ''), ENT_QUOTES); $caption = htmlspecialchars($sc->getParameter('caption', ''), ENT_QUOTES); $credit = htmlspecialchars($sc->getParameter('credit', ''), ENT_QUOTES); $imageUrl = ($page && $imageName) ? $page->url() . '/' . $imageName : $imageName; $captionHtml = ''; if ($caption || $credit) { $creditHtml = $credit ? ' ยท ' . $credit . '' : ''; $captionHtml = '
' . $caption . $creditHtml . '
'; } return << {$alt} {$captionHtml} HTML; }); } }