From 88b1c3ec0dcb7984c35d0fb08da4d927625a0ec9 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sat, 25 Jun 2022 21:04:30 +0300 Subject: [PATCH] feat(shortcodes): add `getProjectUrl` shortcode --- src/flextype/core/Parsers/Shortcodes/UrlShortcode.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/flextype/core/Parsers/Shortcodes/UrlShortcode.php b/src/flextype/core/Parsers/Shortcodes/UrlShortcode.php index 11acac73..42b40209 100644 --- a/src/flextype/core/Parsers/Shortcodes/UrlShortcode.php +++ b/src/flextype/core/Parsers/Shortcodes/UrlShortcode.php @@ -51,6 +51,16 @@ parsers()->shortcodes()->addHandler('getAbsoluteUrl', static function () { return getAbsoluteUrl(); }); +// Shortcode: getProjectUrl +// Usage: (getProjectUrl) +parsers()->shortcodes()->addHandler('getProjectUrl', static function () { + if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.url.enabled')) { + return ''; + } + + return getProjectUrl(); +}); + // Shortcode: getUriString // Usage: (getUriString) parsers()->shortcodes()->addHandler('getUriString', static function () {