From b33eb6f11260a53b4d3c4975d77314ae10bbee6f Mon Sep 17 00:00:00 2001 From: Cord Date: Wed, 17 Jan 2018 14:54:56 +0100 Subject: [PATCH] support for custom shortcodes allow to define path plugins.shortcode-ui.custom_shortcodes to custom shortcodes following the structure of shortcode-ui ``` /user/custom/shortcodes-ui/ /css /js /shortcodes /templates ``` --- shortcode-ui.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shortcode-ui.php b/shortcode-ui.php index 75da8ec..f47d772 100644 --- a/shortcode-ui.php +++ b/shortcode-ui.php @@ -24,6 +24,12 @@ public static function getSubscribedEvents() public function onTwigTemplatePaths() { $this->grav['twig']->twig_paths[] = __DIR__ . '/templates'; + + $custom_shortcodes = $this->config->get('plugins.shortcode-ui.custom_shortcodes'); + if (isset($custom_shortcodes)) { + $this->grav['twig']->twig_paths[] = GRAV_ROOT . $custom_shortcodes.'/templates'; + } + } public function onTwigExtensions() @@ -38,5 +44,9 @@ public function onTwigExtensions() public function onShortcodeHandlers() { $this->grav['shortcode']->registerAllShortcodes(__DIR__.'/shortcodes'); + $custom_shortcodes = $this->config->get('plugins.shortcode-ui.custom_shortcodes'); + if (isset($custom_shortcodes)) { + $this->grav['shortcode']->registerAllShortcodes(GRAV_ROOT . $custom_shortcodes.'/shortcodes'); + } } }