@@ -55,6 +55,16 @@ TwigBundle Configuration ("twig")
5555 paths :
5656 ' %kernel.project_dir%/vendor/acme/foo-bar/templates ' : foo_bar
5757
58+ # The following were added in Symfony 2.7.
59+ date :
60+ format : d.m.Y, H:i:s
61+ interval_format : ' %%d days'
62+ timezone : Asia/Tokyo
63+ number_format :
64+ decimals : 2
65+ decimal_point : ' ,'
66+ thousands_separator : ' .'
67+
5868 .. code-block :: xml
5969
6070 <!-- app/config/config.xml -->
@@ -81,6 +91,9 @@ TwigBundle Configuration ("twig")
8191
8292 <twig : global key =" foo" id =" bar" type =" service" />
8393 <twig : global key =" pi" >3.14</twig : global >
94+
95+ <twig : date format =" d.m.Y, H:i:s" interval-format =" %d days" timezone =" Asia/Tokyo" />
96+ <twig : number-format decimals =" 2" decimal-point =" ," thousands-separator =" ." />
8497
8598 <twig : exception-controller >AcmeFooBundle:Exception:showException</twig : exception-controller >
8699 <twig : path namespace =" foo_bar" >%kernel.project_dir%/vendor/acme/foo-bar/templates</twig : path >
@@ -111,6 +124,16 @@ TwigBundle Configuration ("twig")
111124 'paths' => array(
112125 '%kernel.project_dir%/vendor/acme/foo-bar/templates' => 'foo_bar',
113126 ),
127+ 'date' => array(
128+ 'format' => 'd.m.Y, H:i:s',
129+ 'interval_format' => '%%d days',
130+ 'timezone' => 'Asia/Tokyo',
131+ ),
132+ 'number_format' => array(
133+ 'decimals' => 2,
134+ 'decimal_point' => ',',
135+ 'thousands_separator' => '.',
136+ ),
114137 ));
115138
116139 .. caution ::
@@ -210,6 +233,37 @@ charset
210233The charset used by the template files. In the Symfony Standard edition this
211234defaults to the ``UTF-8 `` charset.
212235
236+ date
237+ ~~~~
238+
239+ These options define the default values used by the ``date `` filter to format
240+ date and time values. They are useful to avoid passing the same arguments on
241+ every ``date `` filter call.
242+
243+ format
244+ ......
245+
246+ **type **: ``string `` **default **: ``F j, Y H:i ``
247+
248+ The format used by the ``date `` filter to display values when no specific format
249+ is passed as argument.
250+
251+ internal_format
252+ ...............
253+
254+ **type **: ``string `` **default **: ``%d days ``
255+
256+ The format used by the ``date `` filter to display ``DateInterval `` instances
257+ when no specific format is passed as argument.
258+
259+ timezone
260+ ........
261+
262+ **type **: ``string `` **default **: (the value returned by ``date_default_timezone_get() ``)
263+
264+ The timezone used when formatting date values with the ``date `` filter and no
265+ specific timezone is passed as argument.
266+
213267debug
214268~~~~~
215269
@@ -234,6 +288,38 @@ option is advanced. If you need to customize an error page you should use
234288the previous link. If you need to perform some behavior on an exception,
235289you should add a listener to the ``kernel.exception `` event (see :ref: `dic-tags-kernel-event-listener `).
236290
291+ number_format
292+ ~~~~~~~~~~~~~
293+
294+ These options define the default values used by the ``number_format `` filter to
295+ format numeric values. They are useful to avoid passing the same arguments on
296+ every ``number_format `` filter call.
297+
298+ decimals
299+ ........
300+
301+ **type **: ``integer `` **default **: ``0 ``
302+
303+ The number of decimals used to format numeric values when no specific number is
304+ passed as argument to the ``number_format `` filter.
305+
306+ decimal_point
307+ .............
308+
309+ **type **: ``string `` **default **: ``. ``
310+
311+ The character used to separate the decimals from the integer part of numeric
312+ values when no specific character is passed as argument to the ``number_format ``
313+ filter.
314+
315+ thousands_separator
316+ ...................
317+
318+ **type **: ``string `` **default **: ``, ``
319+
320+ The character used to separate every group of thousands in numeric values when
321+ no specific character is passed as argument to the ``number_format `` filter.
322+
237323optimizations
238324~~~~~~~~~~~~~
239325
0 commit comments