Skip to content

Commit

Permalink
Blueprints for Admin
Browse files Browse the repository at this point in the history
  • Loading branch information
OleVik committed Jul 17, 2020
1 parent 64e8c8c commit fdc3760
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.3.0
## 17-07-2020

1. [](#new)
* Blueprints for Admin

# v1.2.1
## 28-08-2018

Expand Down
6 changes: 3 additions & 3 deletions blueprints.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions blueprints/fullpage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: Fullpage
extends@:
type: default
context: blueprints://pages
38 changes: 31 additions & 7 deletions fullpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
]);
}

/**
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit fdc3760

Please sign in to comment.