Skip to content

Commit

Permalink
Fix clashing global twig variable
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Dec 7, 2023
1 parent d327aa0 commit c86da15
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -997,15 +997,18 @@ final public function setTwigGlobals(Request $request): void
$twig = $this->container->get('twig');
\assert($twig instanceof Environment);

$twig->addGlobal('admin', $this->admin);
try {
$twig->addGlobal('admin', $this->admin);

if ($this->isXmlHttpRequest($request)) {
$baseTemplate = $this->templateRegistry->getTemplate('ajax');
} else {
$baseTemplate = $this->templateRegistry->getTemplate('layout');
}
if ($this->isXmlHttpRequest($request)) {
$baseTemplate = $this->templateRegistry->getTemplate('ajax');
} else {
$baseTemplate = $this->templateRegistry->getTemplate('layout');
}

$twig->addGlobal('base_template', $baseTemplate);
$twig->addGlobal('base_template', $baseTemplate);
} catch (\LogicException) {
}
}

/**
Expand Down

0 comments on commit c86da15

Please sign in to comment.