Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions docs/simplesamlphp-theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ If you need to make more extensive customizations to the base template, you shou

Any references to `$this->data['baseurlpath']` in old-style templates can be replaced with `{{baseurlpath}}` in Twig templates. Likewise, references to `\SimpleSAML\Module::getModuleURL()` can be replaced with `{{baseurlpath}}module.php/mymodule/...`

Within templates each module is defined as a separate namespace matching the module name. This allows one template to reference templates from other modules using Twig's `@namespace_name/template_path` notation. For instance, a template in `mymodule` can include the widget template from the `yourmodule` module using the notation `@yourmodule/widget.twig`. A special namespace, `__parent__`, exists to allow theme developers to more easily extend a module's stock template.

Even more advanced changes can be made by defining a theme controller in `config.php`:

'theme.controller' => '\SimpleSAML\Module\mymodule\FancyThemeController',
Expand Down
3 changes: 2 additions & 1 deletion lib/SimpleSAML/XHTML/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ private function setupTwigTemplatepaths()
$templateDirs[] = [
$this->theme['module'] => TemplateLoader::getModuleTemplateDir($this->theme['module'])
];
$templateDirs[] = ['__parent__' => TemplateLoader::getModuleTemplateDir($this->module)];
} catch (\InvalidArgumentException $e) {
// either the module is not enabled or it has no "templates" directory, ignore
}
Expand Down Expand Up @@ -524,7 +525,7 @@ public function send()
public function show()
{
if ($this->useNewUI) {
echo $this->getContents();
echo $this->getContents();
} else {
require($this->findTemplatePath($this->template));
}
Expand Down