Skip to content
Snippets Groups Projects
Commit ace479a2 authored by Hanne Moa's avatar Hanne Moa
Browse files

Slight simplification

parent 55941baf
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,7 @@ class SimpleSAML_XHTML_Template ...@@ -57,7 +57,7 @@ class SimpleSAML_XHTML_Template
$this->template = $template; $this->template = $template;
$this->data['baseurlpath'] = $this->configuration->getBaseURL(); $this->data['baseurlpath'] = $this->configuration->getBaseURL();
$this->translator = new \SimpleSAML\Locale\Translate($configuration, $defaultDictionary); $this->translator = new \SimpleSAML\Locale\Translate($configuration, $defaultDictionary);
$this->useTwig = $this->setupTwig(); $this->twig = $this->setupTwig();
} }
...@@ -127,15 +127,14 @@ class SimpleSAML_XHTML_Template ...@@ -127,15 +127,14 @@ class SimpleSAML_XHTML_Template
private function setupTwig() private function setupTwig()
{ {
$cache = $this->configuration->getString('template.cache', $this->configuration->resolvePath('cache')); $cache = $this->configuration->getString('template.cache', $this->configuration->resolvePath('cache'));
// check if template exists // set up template paths if template exists
$loader = $this->setupTwigTemplatepaths(); $loader = $this->setupTwigTemplatepaths();
if (!$loader) { if (!$loader) {
return false; return null;
} }
$auto_reload = $this->configuration->getBoolean('template.auto_reload', false); $auto_reload = $this->configuration->getBoolean('template.auto_reload', false);
$this->twig = new \Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => $auto_reload)); return new \Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => $auto_reload));
return true;
} }
private function findThemeTemplateDirs() private function findThemeTemplateDirs()
...@@ -284,7 +283,7 @@ class SimpleSAML_XHTML_Template ...@@ -284,7 +283,7 @@ class SimpleSAML_XHTML_Template
*/ */
public function show() public function show()
{ {
if ($this->useTwig) { if ($this->twig) {
$this->twigDefaultContext(); $this->twigDefaultContext();
echo $this->twig->render($this->twig_template, $this->data); echo $this->twig->render($this->twig_template, $this->data);
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment