From 98752121c9b970894408a58f091bb01443c048aa Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 11 May 2022 15:12:22 +0300 Subject: [PATCH] feat(shortcodes): add ability to init custom shortcodes --- src/flextype/core/Parsers/Shortcodes.php | 8 +++++--- src/flextype/flextype.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/flextype/core/Parsers/Shortcodes.php b/src/flextype/core/Parsers/Shortcodes.php index 115c0cd6..37ed3e2e 100644 --- a/src/flextype/core/Parsers/Shortcodes.php +++ b/src/flextype/core/Parsers/Shortcodes.php @@ -84,11 +84,13 @@ final class Shortcodes /** * Init Shortcodes + * + * @param array $shortcodes Shortcoes to init. + * + * @return void */ - public function initShortcodes(): void + public function initShortcodes(array $shortcodes): void { - $shortcodes = registry()->get('flextype.settings.parsers.shortcodes.shortcodes'); - if ( ! isset($shortcodes) || ! is_array($shortcodes) || diff --git a/src/flextype/flextype.php b/src/flextype/flextype.php index 01ddcbb6..fa2e6bc3 100644 --- a/src/flextype/flextype.php +++ b/src/flextype/flextype.php @@ -338,7 +338,7 @@ container()->set('cache', static function () { container()->set('parsers', new Parsers()); // Init Shortcodes -parsers()->shortcodes()->initShortcodes(); +parsers()->shortcodes()->initShortcodes(registry()->get('flextype.settings.parsers.shortcodes.shortcodes')); // Add Serializers Service container()->set('serializers', new Serializers());