From fdc3760e1f09a7ae87c18755ce6c607f067413db Mon Sep 17 00:00:00 2001 From: Ole Vik Date: Fri, 17 Jul 2020 20:25:26 +0200 Subject: [PATCH] Blueprints for Admin --- CHANGELOG.md | 6 ++++++ blueprints.yaml | 6 +++--- blueprints/fullpage.yaml | 4 ++++ fullpage.php | 38 +++++++++++++++++++++++++++++++------- 4 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 blueprints/fullpage.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fe9c23..12f2455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.3.0 +## 17-07-2020 + +1. [](#new) + * Blueprints for Admin + # v1.2.1 ## 28-08-2018 diff --git a/blueprints.yaml b/blueprints.yaml index 9dd34b1..cc3f21a 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: FullPage -version: 1.2.1 +version: 1.3.0 testing: false description: Fullscreen navigational slideshows through fullPage.js icon: arrows-alt @@ -13,8 +13,8 @@ bugs: https://github.com/OleVik/grav-plugin-fullpage/issues docs: https://github.com/OleVik/grav-plugin-fullpage/blob/develop/README.md license: MIT dependencies: - - { name: grav, version: '>=1.3' } - - { name: admin, version: '>=1.5' } + - { name: grav, version: ">=1.3" } + - { name: admin, version: ">=1.5" } form: validation: strict diff --git a/blueprints/fullpage.yaml b/blueprints/fullpage.yaml new file mode 100644 index 0000000..47dc4d8 --- /dev/null +++ b/blueprints/fullpage.yaml @@ -0,0 +1,4 @@ +title: Fullpage +extends@: + type: default + context: blueprints://pages diff --git a/fullpage.php b/fullpage.php index 096cdf7..59b5575 100644 --- a/fullpage.php +++ b/fullpage.php @@ -68,14 +68,19 @@ public function config() public function onPluginsInitialized(Event $event) { if ($this->isAdmin()) { - return; + $this->enable( + [ + 'onGetPageTemplates' => ['onGetPageTemplates', 0] + ] + ); + } else { + $this->grav['config']->set('system.cache.enabled', false); + $this->enable([ + 'onPageContentProcessed' => ['pageIteration', 0], + 'onTwigTemplatePaths' => ['templates', 0], + 'onShutdown' => ['onShutdown', 0] + ]); } - $this->grav['config']->set('system.cache.enabled', false); - $this->enable([ - 'onPageContentProcessed' => ['pageIteration', 0], - 'onTwigTemplatePaths' => ['templates', 0], - 'onShutdown' => ['onShutdown', 0] - ]); } /** @@ -151,6 +156,25 @@ public function pageIteration() } } + /** + * Register templates and blueprints + * + * @param RocketTheme\Toolbox\Event\Event $event Event handler + * + * @return void + */ + public function onGetPageTemplates(Event $event) + { + $types = $event->types; + $res = $this->grav['locator']; + $types->scanBlueprints( + $res->findResource('plugin://' . $this->name . '/blueprints') + ); + $types->scanTemplates( + $res->findResource('plugin://' . $this->name . '/templates') + ); + } + /** * Add templates-directory to Twig paths *