['onShortcodeHandlers', 0], 'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0], 'onPageContentRaw' => ['onPageContentRaw', 1000], // before the Shortcode Core plugin 'onPageContentProcessed' => ['onPageContentProcessed', 1000], // before the Shortcode Core plugin ]; } /** * Add current directory to twig lookup paths. */ public function onTwigTemplatePaths() { $this->grav['twig']->twig_paths[] = __DIR__ . '/templates'; } /** * Detect which page is being processed, even if it is in a collection. * We store it so that our shortcode can use it. */ public function onPageContentRaw(Event $event) { $this->currentPage = $event['page']; } public function onPageContentProcessed(Event $event) { $this->currentPage = $event['page']; } public function getCurrentPage() { return $this->currentPage; } /** * Initialize configuration */ public function onShortcodeHandlers() { $this->grav['debugger']->addMessage('Adding shortcodes from ' . __DIR__ . '/shortcodes'); $this->grav['shortcode']->registerAllShortcodes(__DIR__ . '/shortcodes'); } }