Skip to content
Snippets Groups Projects
Unverified Commit b6de826b authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Add docs on theme.controller setting (#1026)

* Update simplesamlphp-theming.md

* Add theme.controller config setting
parent f8207652
No related branches found
No related tags found
No related merge requests found
......@@ -792,6 +792,15 @@ $config = [
*/
//'theme.header' => 'SimpleSAMLphp'
/**
* A template controller, if any.
*
* Used to intercept certain parts of the template handling, while keeping away unwanted/unexpected hooks. Set
* the 'theme.controller' configuration option to a class that implements the
* \SimpleSAML\XHTML\TemplateControllerInterface interface to use it.
*/
//'theme.controller' => '',
/*
* Templating options
*
......
......@@ -99,6 +99,7 @@ You can put resource files within the www folder of your module, to make your mo
```
modules
└───mymodule
└───lib
└───themes
└───www
└───logo.png
......@@ -130,6 +131,13 @@ 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/...`
Even more advanced changes can be made by defining a theme controller in `config.php`:
'theme.controller' => '\SimpleSAML\Module\mymodule\FancyThemeController',
This requires you to implement `\SimpleSAML\XHTML\TemplateControllerInterface.php` in your module's `lib`-directory.
The class can then modify the Twig Environment and the variables passed to the theme's templates. In short, this allows you to set additional global variables and to write your own Twig filters and functions.
See the [Twig documentation](https://twig.symfony.com/doc/1.x/templates.html) for more information on using variables and expressions in Twig templates, and the SimpleSAMLphp wiki for [our conventions](https://github.com/simplesamlphp/simplesamlphp/wiki/Twig-conventions).
The wiki also includes some information on [migrating translations](https://github.com/simplesamlphp/simplesamlphp/wiki/Migrating-translation-in-Twig) and [migrating templates](https://github.com/simplesamlphp/simplesamlphp/wiki/Twig:-Migrating-templates).
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