Skip to content

Commit

Permalink
Merge branch 'release/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sommerregen committed Aug 21, 2015
2 parents bd5a3f0 + d32886e commit f379037
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.0.1
## 08/21/2015

3. [](#bugfix)
* Fixed missing Twig update routines

# v1.0.0
## 08/20/2015

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Themer
version: 1.0.0
version: 1.0.1
description: "This plugin enables you to use different themes on one site individual set per page or collection."
icon: magic
author:
Expand Down
23 changes: 21 additions & 2 deletions themer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Themer v1.0.0
* Themer v1.0.1
*
* This plugin enables you to use different themes on one site
* individual set per page or collection.
Expand All @@ -9,7 +9,7 @@
* http://benjamin-regler.de/license/
*
* @package Themer
* @version 1.0.0
* @version 1.0.1
* @link <https://github.com/sommerregen/grav-plugin-themer>
* @author Benjamin Regler <[email protected]>
* @copyright 2015, Benjamin Regler
Expand All @@ -21,6 +21,7 @@

use Grav\Common\Plugin;
use Grav\Common\Page\Page;
use Grav\Common\Twig\TraceableTwigEnvironment;

/**
* ThemerPlugin
Expand Down Expand Up @@ -77,6 +78,24 @@ public function onPageInitialized()

// Reload themes to reflect changes
$this->grav['themes']->init();

// Silent DebugBar error :: 'twig' is already a registered collector
if ($debug = $this->config->get('system.debugger.twig', false)) {
$this->config->set('system.debugger.twig', false);
}

// Reset and re-initialize Twig environment
$twig = $this->grav['twig'];
$twig->twig = null;
$twig->twig_paths = [];
$twig->init();

// Update TwigCollector for DebugBar
if ($debug) {
$twig->twig = new TraceableTwigEnvironment($twig->twig);
$collector = $this->grav['debugger']->getCollector('twig');
$collector->twig = $twig->twig;
}
}
}
}
Expand Down

0 comments on commit f379037

Please sign in to comment.