Skip to content

Commit

Permalink
Twig extension error in control panel
Browse files Browse the repository at this point in the history
  • Loading branch information
ryssbowh committed May 10, 2021
1 parent 62dbb55 commit 68f8b35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ryssbowh/craft-themes Changelog

## 2.1.1 - 2021-05-10

### Fixed
- Twig extension error in control panel

## 2.1.0 - 2021-05-08

### Changed
Expand Down
3 changes: 2 additions & 1 deletion src/Themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public function init()
]
]);

Craft::$app->view->registerTwigExtension(new TwigTheme);

Event::on(ClearCaches::class, ClearCaches::EVENT_REGISTER_CACHE_OPTIONS,
function (RegisterCacheOptionsEvent $event) {
$event->options[] = [
Expand Down Expand Up @@ -115,7 +117,6 @@ protected function resolveTheme(RegisterTemplateRootsEvent $event)

\Yii::setAlias('@themePath', '@root/themes/' . $theme->handle);
\Yii::setAlias('@themeWebPath', '@webroot/themes/' . $theme->handle);
Craft::$app->view->registerTwigExtension(new TwigTheme);
$event->roots[''] = array_merge($theme->getTemplatePaths(), $event->roots[''] ?? []);
$path = \Craft::$app->request->getPathInfo();
$theme->registerAssetBundles($path);
Expand Down

0 comments on commit 68f8b35

Please sign in to comment.