diff --git a/src/flextype/core/Parsers/Shortcodes/VarShortcode.php b/src/flextype/core/Parsers/Shortcodes/VarShortcode.php new file mode 100644 index 00000000..0dce4170 --- /dev/null +++ b/src/flextype/core/Parsers/Shortcodes/VarShortcode.php @@ -0,0 +1,30 @@ +shortcodes()->addHandler('var', static function (ShortcodeInterface $s) { + if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.var.enabled')) { + return ''; + } + + return entries()->registry()->get('methods.fetch.result.vars.' . parsers()->shortcodes()->parse($s->getBBCode())); +}); diff --git a/src/flextype/settings.yaml b/src/flextype/settings.yaml index 0c63a699..755051b6 100644 --- a/src/flextype/settings.yaml +++ b/src/flextype/settings.yaml @@ -625,6 +625,9 @@ parsers: uuid: enabled: true path: "/src/flextype/core/Parsers/Shortcodes/UuidShortcode.php" + var: + enabled: true + path: "/src/flextype/core/Parsers/Shortcodes/VarShortcode.php" # CORS # diff --git a/tests/fixtures/settings/settings.yaml b/tests/fixtures/settings/settings.yaml index 39faf8ea..401918b0 100644 --- a/tests/fixtures/settings/settings.yaml +++ b/tests/fixtures/settings/settings.yaml @@ -606,7 +606,10 @@ parsers: uuid: enabled: true path: "/src/flextype/core/Parsers/Shortcodes/UuidShortcode.php" - + var: + enabled: true + path: "/src/flextype/core/Parsers/Shortcodes/VarShortcode.php" + # CORS # # CORS (Cross-origin resource sharing) allows JavaScript web apps to make HTTP requests to other domains.