diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index 25207b4039c..954b6ad1d46 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -53,6 +53,16 @@ TwigBundle Configuration ("twig") paths: '%kernel.root_dir%/../vendor/acme/foo-bar/templates': foo_bar + # The following were added in Symfony 2.7. + date: + format: d.m.Y, H:i:s + interval_format: '%%d days' + timezone: Asia/Tokyo + number_format: + decimals: 2 + decimal_point: ',' + thousands_separator: '.' + .. code-block:: xml @@ -79,6 +89,9 @@ TwigBundle Configuration ("twig") 3.14 + + + AcmeFooBundle:Exception:showException %kernel.root_dir%/../vendor/acme/foo-bar/templates @@ -92,23 +105,33 @@ TwigBundle Configuration ("twig") 'form_themes' => array( 'form_div_layout.html.twig', // Default 'form.html.twig', - ), - 'globals' => array( - 'foo' => '@bar', - 'pi' => 3.14, - ), - 'auto_reload' => '%kernel.debug%', - 'autoescape' => 'name', - 'base_template_class' => 'Twig_Template', - 'cache' => '%kernel.cache_dir%/twig', - 'charset' => '%kernel.charset%', - 'debug' => '%kernel.debug%', - 'strict_variables' => false, - 'exception_controller' => 'AcmeFooBundle:Exception:showException', - 'optimizations' => true, - 'paths' => array( - '%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar', - ), + ), + 'globals' => array( + 'foo' => '@bar', + 'pi' => 3.14, + ), + 'auto_reload' => '%kernel.debug%', + 'autoescape' => 'name', + 'base_template_class' => 'Twig_Template', + 'cache' => '%kernel.cache_dir%/twig', + 'charset' => '%kernel.charset%', + 'debug' => '%kernel.debug%', + 'strict_variables' => false, + 'exception_controller' => 'AcmeFooBundle:Exception:showException', + 'optimizations' => true, + 'paths' => array( + '%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar', + ), + 'date' => array( + 'format' => 'd.m.Y, H:i:s', + 'interval_format' => '%%d days', + 'timezone' => 'Asia/Tokyo', + ), + 'number_format' => array( + 'decimals' => 2, + 'decimal_point' => ',', + 'thousands_separator' => '.', + ), )); .. caution:: @@ -208,6 +231,37 @@ charset The charset used by the template files. In the Symfony Standard edition this defaults to the ``UTF-8`` charset. +date +~~~~ + +These options define the default values used by the ``date`` filter to format +date and time values. They are useful to avoid passing the same arguments on +every ``date`` filter call. + +format +...... + +**type**: ``string`` **default**: ``F j, Y H:i`` + +The format used by the ``date`` filter to display values when no specific format +is passed as argument. + +internal_format +............... + +**type**: ``string`` **default**: ``%d days`` + +The format used by the ``date`` filter to display ``DateInterval`` instances +when no specific format is passed as argument. + +timezone +........ + +**type**: ``string`` **default**: (the value returned by ``date_default_timezone_get()``) + +The timezone used when formatting date values with the ``date`` filter and no +specific timezone is passed as argument. + debug ~~~~~ @@ -232,6 +286,38 @@ 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 :ref:`dic-tags-kernel-event-listener`). +number_format +~~~~~~~~~~~~~ + +These options define the default values used by the ``number_format`` filter to +format numeric values. They are useful to avoid passing the same arguments on +every ``number_format`` filter call. + +decimals +........ + +**type**: ``integer`` **default**: ``0`` + +The number of decimals used to format numeric values when no specific number is +passed as argument to the ``number_format`` filter. + +decimal_point +............. + +**type**: ``string`` **default**: ``.`` + +The character used to separate the decimals from the integer part of numeric +values when no specific character is passed as argument to the ``number_format`` +filter. + +thousands_separator +................... + +**type**: ``string`` **default**: ``,`` + +The character used to separate every group of thousands in numeric values when +no specific character is passed as argument to the ``number_format`` filter. + optimizations ~~~~~~~~~~~~~ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy