1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-07 21:56:33 +02:00

feat(shortcodes): add var shortcode

This commit is contained in:
Awilum
2022-05-25 17:36:02 +03:00
parent a20fdb62fe
commit c2e3175c65
3 changed files with 37 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/**
* Flextype - Hybrid Content Management System with the freedom of a headless CMS
* and with the full functionality of a traditional CMS!
*
* Copyright (c) Sergey Romanenko (https://awilum.github.io)
*
* Licensed under The MIT License.
*
* For full copyright and license information, please see the LICENSE
* Redistributions of files must retain the above copyright notice.
*/
namespace Flextype\Parsers\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
use function registry;
// Shortcode: var
// Usage: (var:foo)
parsers()->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()));
});

View File

@@ -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
#

View File

@@ -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.