wiki-grav/plugins/shortcode-core/classes/shortcodes/SizeShortcode.php
2023-06-02 08:07:58 +02:00

20 lines
523 B
PHP

<?php
namespace Grav\Plugin\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
class SizeShortcode extends Shortcode
{
public function init()
{
$this->shortcode->getHandlers()->add('size', function(ShortcodeInterface $sc) {
$size = $sc->getParameter('size', $this->getBbCode($sc));
if (is_numeric($size)) {
$size .= 'px';
}
return '<span style="font-size: ' . $size . ';">' . $sc->getContent() . '</span>';
});
}
}