Skip to content

Commit d93952a

Browse files
committed
Minor tweaks
1 parent 30b00e6 commit d93952a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

templating/twig_extension.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Here's how to create a custom **function**::
7575
public function getFunctions()
7676
{
7777
return array(
78-
new TwigFunction('total', array($this, 'calculateArea')),
78+
new TwigFunction('area', array($this, 'calculateArea')),
7979
);
8080
}
8181

@@ -142,16 +142,15 @@ Using your newly created Twig Extension is no different than any other:
142142

143143
.. code-block:: twig
144144
145-
{# outputs $5,500.00 #}
145+
{# Using the filter without arguments. Outputs $5,500.00 #}
146146
{{ '5500'|price }}
147147
148-
Passing other arguments to your filter:
149-
150-
.. code-block:: twig
151-
152-
{# outputs $5500,2516 #}
148+
{# Passing arguments to the filter. Outputs $5500,2516 #}
153149
{{ '5500.25155'|price(4, ',', '') }}
154150
151+
{# Passing arguments to the function. Outputs 140 #}
152+
Total area: {{ area(20, 7) }}
153+
155154
Learning further
156155
----------------
157156

0 commit comments

Comments
 (0)