feat: add story-blocks plugin with chapter-break shortcode

This commit is contained in:
2026-06-19 22:43:54 +02:00
parent 916969c96f
commit c514bfd4a9
3 changed files with 85 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace Grav\Plugin;
use Grav\Common\Plugin;
use RocketTheme\Toolbox\Event\Event;
class StoryBlocksPlugin extends Plugin
{
private $currentPage = null;
public static function getSubscribedEvents(): array
{
return [
'onShortcodeHandlers' => ['onShortcodeHandlers', 0],
'onPageContentRaw' => ['onPageContentRaw', 1000],
];
}
public function onPageContentRaw(Event $event): void
{
$this->currentPage = $event['page'];
}
public function getCurrentPage()
{
return $this->currentPage;
}
public function onShortcodeHandlers(): void
{
$this->grav['shortcode']->registerAllShortcodes(__DIR__ . '/shortcodes');
}
}