Hello everyone!
I want to expand Shortcode Core Plugin without creating a plugin.
Can you tell me how to access the images (theme://images)?
<?php
namespace Grav\Plugin\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
class IconShortcode extends Shortcode
{
public function init()
{
$this->shortcode->getHandlers()->add('icon', function(ShortcodeInterface $sc) {
$class = $sc->getParameter('class');
$icon = $sc->getParameter('icon');
$color = $sc->getParameter('color');
$svg = $sc->getParameter('svg');
$wh = $sc->getParameter('wh');
$class_output = $class ? ' class="' . $class . '"' : '';
$icon_output = $icon ? '<span class="uk-margin-small-right" uk-icon="icon: ' . $icon . '"></span>' : '';
$svg_output = $svg ? '<img src="theme://images/svg/' . $svg . '.svg" width="' . $wh . '" height="' . $wh . '" uk-svg>' : '';
$content = $sc->getContent();
if ($svg_output) {
$content = $svg_output . $content;
}
if ($icon_output) {
$content = $icon_output . $content;
}
return $content;
});
}
}