feat: add story-blocks plugin with chapter-break shortcode
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user