TwigBundle Configuration ("twig")
Edit this pageWarning: You are browsing the documentation for Symfony 2.2, which is no longer maintained.
Read the updated version of this page for Symfony 6.0 (the current stable version).
TwigBundle Configuration ("twig")
- YAML
- XML
- PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
twig:
exception_controller: twig.controller.exception:showAction
form:
resources:
# Default:
- form_div_layout.html.twig
# Example:
- MyBundle::form.html.twig
globals:
# Examples:
foo: "@bar"
pi: 3.14
# Example options, but the easiest use is as seen above
some_variable_name:
# a service id that should be the value
id: ~
# set to service or leave blank
type: ~
value: ~
autoescape: ~
base_template_class: ~ # Example: Twig_Template
cache: "%kernel.cache_dir%/twig"
charset: "%kernel.charset%"
debug: "%kernel.debug%"
strict_variables: ~
auto_reload: ~
optimizations: ~
Configuration
exception_controller
type: string
default: twig.controller.exception:showAction
This is the controller that is activated after an exception is thrown anywhere
in your application. The default controller
(ExceptionController)
is what's responsible for rendering specific templates under different error
conditions (see How to customize Error Pages). Modifying this
option is advanced. If you need to customize an error page you should use
the previous link. If you need to perform some behavior on an exception,
you should add a listener to the kernel.exception
event (see The Dependency Injection Tags).