From 6148fb14cec614e8dec1c97094e980faa09c398f Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 1 Jul 2019 12:26:36 +0300 Subject: [PATCH] - Flextype Core: New Shortcode [registry_get] - added. #165 --- flextype/shortcodes/RegistryShortcode.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 flextype/shortcodes/RegistryShortcode.php diff --git a/flextype/shortcodes/RegistryShortcode.php b/flextype/shortcodes/RegistryShortcode.php new file mode 100644 index 00000000..8a784909 --- /dev/null +++ b/flextype/shortcodes/RegistryShortcode.php @@ -0,0 +1,21 @@ + + * @link http://romanenko.digital + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Flextype; + +use Thunder\Shortcode\ShortcodeFacade; +use Thunder\Shortcode\Shortcode\ShortcodeInterface; + +// Shortcode: [registry_get name="item-name" default="default-value"] +$flextype['shortcodes']->addHandler('registry_get', function (ShortcodeInterface $s) use ($flextype) { + return $flextype['registry']->get($s->getParameter('name'), $s->getParameter('default')); +});