shortcode->getHandlers()->add('pull-quote', 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); $content = trim($sc->getContent()); // ShortcodeCore renders inner Markdown to HTML; trusted author content $imageUrl = ($page && $imageName) ? $page->url() . '/' . $imageName : ''; $bgHtml = ''; if ($imageUrl) { $bgHtml = << {$alt}
HTML; } $innerClass = $imageUrl ? 'pull-quote__inner' : 'pull-quote__inner pull-quote__inner--no-image'; return << {$bgHtml}

{$content}

HTML; }); } }