diff --git a/source/development/user-interface/layout-template-usage.rst b/source/development/user-interface/layout-template-usage.rst index e67221e75..14404b907 100644 --- a/source/development/user-interface/layout-template-usage.rst +++ b/source/development/user-interface/layout-template-usage.rst @@ -14,6 +14,38 @@ We recommand the use of the existing layouts to ensure the consistency of the de The layouts are twig templates. +Twig templating helper +====================== + +`chill_print_or_message` +------------------------ + +Print a value or use a default template if the value is empty. + +The template can be customized. + +Two default templates are registered: + +- :code:`default`, do not decorate the value ; +- :code:`blockquote`: wrap the value into a blockquote if exists + +.. code-block:: html+twig + + {{ "This is a message"|chill_print_or_message("No message") }} + + + {{ ""|chill_print_or_message("No message")}} + + + {{ "This is a comment\n with multiples lines"|chill_print_or_message("No comment", 'blockquote') }} + + +When customizing the template, two arguments are passed to the template: + +- :code:`value`: the actual value ; +- :code:`message`: the message, given as argument + + Organisation of the layouts =========================== @@ -159,7 +191,7 @@ The accepted parameters are : Usage : -.. code-block:: html+jinja2 +.. code-block:: html+twig {{ include('ChillMainBundle:Util:confirmation_template.html.twig', {