mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 14:36:13 +00:00
add doc for chill_print_or_message
This commit is contained in:
parent
dec55131df
commit
f2cfc12d7f
@ -14,6 +14,38 @@ We recommand the use of the existing layouts to ensure the consistency of the de
|
|||||||
|
|
||||||
The layouts are twig templates.
|
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") }}
|
||||||
|
<!-- will print "This is a message" -->
|
||||||
|
|
||||||
|
{{ ""|chill_print_or_message("No message")}}
|
||||||
|
<!-- will print <span class="chill-no-data-statement">No message</span> -->
|
||||||
|
|
||||||
|
{{ "This is a comment\n with multiples lines"|chill_print_or_message("No comment", 'blockquote') }}
|
||||||
|
<!-- will print <blockquote class="chill-user-quote">This is a comment<br/>with multiples lines</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
|
Organisation of the layouts
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
@ -159,7 +191,7 @@ The accepted parameters are :
|
|||||||
Usage :
|
Usage :
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: html+jinja2
|
.. code-block:: html+twig
|
||||||
|
|
||||||
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
|
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user