1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-06 05:07:41 +02:00

feat(shortcodes): add new shortcode url

This commit is contained in:
Awilum
2022-07-08 15:05:27 +03:00
parent 8b12a97583
commit d336f510a7

View File

@@ -27,6 +27,17 @@ use function Flextype\parsers;
use function Flextype\registry;
use function Flextype\serializers;
use function Flextype\urlFor;
use function Flextype\url;
// Shortcode: url
// Usage: (url)
parsers()->shortcodes()->addHandler('url', static function (ShortcodeInterface $s) {
if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.url.enabled')) {
return '';
}
return url($s->getBBCode() !== null ? $s->getBBCode() : '', $s->getParameter('prefix') !== null ? $s->getParameter('prefix') : 'base');
});
// Shortcode: getBaseUrl
// Usage: (getBaseUrl)