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

27 lines
967 B
PHP

<?php
namespace Grav\Plugin\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
class AlignShortcode extends Shortcode
{
public function init()
{
$this->shortcode->getHandlers()->add('center', static function(ShortcodeInterface $sc) {
return '<div style="text-align: center;">' . $sc->getContent() . '</div>';
});
$this->shortcode->getHandlers()->add('left', static function(ShortcodeInterface $sc) {
return '<div style="text-align: left;">' . $sc->getContent() . '</div>';
});
$this->shortcode->getHandlers()->add('right', static function(ShortcodeInterface $sc) {
return '<div style="text-align: right;">' . $sc->getContent() . '</div>';
});
$this->shortcode->getHandlers()->add('justify', static function(ShortcodeInterface $sc) {
return '<div style="text-align: justify;">' . $sc->getContent() . '</div>';
});
}
}