mirror of
https://github.com/flextype/flextype.git
synced 2025-08-06 13:16:45 +02:00
feat(shortcodes): update [registry-get] shortcode
This commit is contained in:
@@ -21,8 +21,8 @@ use Thunder\Shortcode\Shortcode\ShortcodeInterface;
|
||||
use function parsers;
|
||||
use function registry;
|
||||
|
||||
// Shortcode: [registry_get name="item-name" default="default-value"]
|
||||
parsers()->shortcodes()->addHandler('registry_get', static function (ShortcodeInterface $s) {
|
||||
// Shortcode: [registry-get name="item-name" default="default-value"]
|
||||
parsers()->shortcodes()->addHandler('registry-get', static function (ShortcodeInterface $s) {
|
||||
if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.registry.enabled')) {
|
||||
return '';
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
test('[registry_get] shortcode', function () {
|
||||
test('[registry-get] shortcode', function () {
|
||||
$this->assertEquals('Flextype',
|
||||
parsers()->shortcodes()->parse('[registry_get name="flextype.manifest.name"]'));
|
||||
parsers()->shortcodes()->parse('[registry-get name="flextype.manifest.name"]'));
|
||||
$this->assertEquals('default-value',
|
||||
parsers()->shortcodes()->parse('[registry_get name="item-name" default="default-value"]'));
|
||||
parsers()->shortcodes()->parse('[registry-get name="item-name" default="default-value"]'));
|
||||
});
|
||||
|
Reference in New Issue
Block a user