Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/cms/classes/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@ protected function postProcessResult($page, $url, $content)
protected function initTwigEnvironment()
{
$this->twig = App::make('twig.environment.cms');
// Ensure that $this['controller'] is available at all times in the base Twig context
// so that CMS Twig functions (in Cms\Twig\Extension) work inside of Macros
// @see https://github.com/wintercms/winter/issues/578
$this->twig->addGlobal('this', ['controller' => $this]);
}

/**
Expand Down