@@ -53,6 +53,16 @@ TwigBundle Configuration ("twig")
5353 paths :
5454 ' %kernel.root_dir%/../vendor/acme/foo-bar/templates ' : foo_bar
5555
56+ # The following were added in Symfony 2.7.
57+ date :
58+ format : d.m.Y, H:i:s
59+ interval_format : ' %%d days'
60+ timezone : Asia/Tokyo
61+ number_format :
62+ decimals : 2
63+ decimal_point : ' ,'
64+ thousands_separator : ' .'
65+
5666 .. code-block :: xml
5767
5868 <!-- app/config/config.xml -->
@@ -79,6 +89,9 @@ TwigBundle Configuration ("twig")
7989
8090 <twig : global key =" foo" id =" bar" type =" service" />
8191 <twig : global key =" pi" >3.14</twig : global >
92+
93+ <twig : date format =" d.m.Y, H:i:s" interval-format =" %d days" timezone =" Asia/Tokyo" />
94+ <twig : number-format decimals =" 2" decimal-point =" ," thousands-separator =" ." />
8295
8396 <twig : exception-controller >AcmeFooBundle:Exception:showException</twig : exception-controller >
8497 <twig : path namespace =" foo_bar" >%kernel.root_dir%/../vendor/acme/foo-bar/templates</twig : path >
@@ -92,23 +105,33 @@ TwigBundle Configuration ("twig")
92105 'form_themes' => array(
93106 'form_div_layout.html.twig', // Default
94107 'form.html.twig',
95- ),
96- 'globals' => array(
97- 'foo' => '@bar',
98- 'pi' => 3.14,
99- ),
100- 'auto_reload' => '%kernel.debug%',
101- 'autoescape' => 'name',
102- 'base_template_class' => 'Twig_Template',
103- 'cache' => '%kernel.cache_dir%/twig',
104- 'charset' => '%kernel.charset%',
105- 'debug' => '%kernel.debug%',
106- 'strict_variables' => false,
107- 'exception_controller' => 'AcmeFooBundle:Exception:showException',
108- 'optimizations' => true,
109- 'paths' => array(
110- '%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar',
111- ),
108+ ),
109+ 'globals' => array(
110+ 'foo' => '@bar',
111+ 'pi' => 3.14,
112+ ),
113+ 'auto_reload' => '%kernel.debug%',
114+ 'autoescape' => 'name',
115+ 'base_template_class' => 'Twig_Template',
116+ 'cache' => '%kernel.cache_dir%/twig',
117+ 'charset' => '%kernel.charset%',
118+ 'debug' => '%kernel.debug%',
119+ 'strict_variables' => false,
120+ 'exception_controller' => 'AcmeFooBundle:Exception:showException',
121+ 'optimizations' => true,
122+ 'paths' => array(
123+ '%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar',
124+ ),
125+ 'date' => array(
126+ 'format' => 'd.m.Y, H:i:s',
127+ 'interval_format' => '%%d days',
128+ 'timezone' => 'Asia/Tokyo',
129+ ),
130+ 'number_format' => array(
131+ 'decimals' => 2,
132+ 'decimal_point' => ',',
133+ 'thousands_separator' => '.',
134+ ),
112135 ));
113136
114137 .. caution ::
@@ -208,6 +231,37 @@ charset
208231The charset used by the template files. In the Symfony Standard edition this
209232defaults to the ``UTF-8 `` charset.
210233
234+ date
235+ ~~~~
236+
237+ These options define the default values used by the ``date `` filter to format
238+ date and time values. They are useful to avoid passing the same arguments on
239+ every ``date `` filter call.
240+
241+ format
242+ ......
243+
244+ **type **: ``string `` **default **: ``F j, Y H:i ``
245+
246+ The format used by the ``date `` filter to display values when no specific format
247+ is passed as argument.
248+
249+ internal_format
250+ ...............
251+
252+ **type **: ``string `` **default **: ``%d days ``
253+
254+ The format used by the ``date `` filter to display ``DateInterval `` instances
255+ when no specific format is passed as argument.
256+
257+ timezone
258+ ........
259+
260+ **type **: ``string `` **default **: (the value returned by ``date_default_timezone_get() ``)
261+
262+ The timezone used when formatting date values with the ``date `` filter and no
263+ specific timezone is passed as argument.
264+
211265debug
212266~~~~~
213267
@@ -232,6 +286,38 @@ option is advanced. If you need to customize an error page you should use
232286the previous link. If you need to perform some behavior on an exception,
233287you should add a listener to the ``kernel.exception `` event (see :ref: `dic-tags-kernel-event-listener `).
234288
289+ number_format
290+ ~~~~~~~~~~~~~
291+
292+ These options define the default values used by the ``number_format `` filter to
293+ format numeric values. They are useful to avoid passing the same arguments on
294+ every ``number_format `` filter call.
295+
296+ decimals
297+ ........
298+
299+ **type **: ``integer `` **default **: ``0 ``
300+
301+ The number of decimals used to format numeric values when no specific number is
302+ passed as argument to the ``number_format `` filter.
303+
304+ decimal_point
305+ .............
306+
307+ **type **: ``string `` **default **: ``. ``
308+
309+ The character used to separate the decimals from the integer part of numeric
310+ values when no specific character is passed as argument to the ``number_format ``
311+ filter.
312+
313+ thousands_separator
314+ ...................
315+
316+ **type **: ``string `` **default **: ``, ``
317+
318+ The character used to separate every group of thousands in numeric values when
319+ no specific character is passed as argument to the ``number_format `` filter.
320+
235321optimizations
236322~~~~~~~~~~~~~
237323
0 commit comments