2
2
3
3
namespace TwigGenerator \Extension ;
4
4
5
+ use Twig \Extension \AbstractExtension ;
6
+ use Twig \TwigFunction ;
7
+
5
8
/**
6
9
* @author Cedric LOMBARDOT
7
10
* @author Piotr Gołębiewski <[email protected] >
8
11
* @author Stéphane Escandell
9
12
*/
10
- class TwigPrintExtension extends \Twig_Extension
13
+ class TwigPrintExtension extends AbstractExtension
11
14
{
12
15
/**
13
16
* @var array
@@ -20,28 +23,28 @@ class TwigPrintExtension extends \Twig_Extension
20
23
public function getFunctions ()
21
24
{
22
25
return array (
23
- 'echo_twig ' => new \ Twig_SimpleFunction ('echo_twig ' , array ($ this , 'getEchoTwig ' )),
24
- 'echo_block ' => new \ Twig_SimpleFunction ('echo_block ' , array ($ this , 'getEchoBlock ' )),
25
- 'echo_endblock ' => new \ Twig_SimpleFunction ('echo_endblock ' , array ($ this , 'getEchoEndBlock ' )),
26
- 'echo_for ' => new \ Twig_SimpleFunction ('echo_for ' , array ($ this , 'getEchoFor ' )),
27
- 'echo_endfor ' => new \ Twig_SimpleFunction ('echo_endfor ' , array ($ this , 'getEchoEndFor ' )),
28
- 'echo_raw ' => new \ Twig_SimpleFunction ('echo_raw ' , array ($ this , 'getEchoRaw ' )),
29
- 'echo_endraw ' => new \ Twig_SimpleFunction ('echo_endraw ' , array ($ this , 'getEchoEndRaw ' )),
30
- 'echo_spaceless ' => new \ Twig_SimpleFunction ('echo_spaceless ' , array ($ this , 'getEchoSpaceless ' )),
31
- 'echo_endspaceless ' => new \ Twig_SimpleFunction ('echo_endspaceless ' , array ($ this , 'getEchoEndSpaceless ' )),
32
- 'echo_extends ' => new \ Twig_SimpleFunction ('echo_extends ' , array ($ this , 'getEchoExtends ' )),
33
- 'echo_if ' => new \ Twig_SimpleFunction ('echo_if ' , array ($ this , 'getEchoIf ' )),
34
- 'echo_else ' => new \ Twig_SimpleFunction ('echo_else ' , array ($ this , 'getEchoElse ' )),
35
- 'echo_elseif ' => new \ Twig_SimpleFunction ('echo_elseif ' , array ($ this , 'getEchoElseIf ' )),
36
- 'echo_endif ' => new \ Twig_SimpleFunction ('echo_endif ' , array ($ this , 'getEchoEndIf ' )),
37
- 'echo_set ' => new \ Twig_SimpleFunction ('echo_set ' , array ($ this , 'getEchoSet ' )),
38
- 'echo_twig_arr ' => new \ Twig_SimpleFunction ('echo_twig_arr ' , array ($ this , 'getEchoTwigArr ' )),
39
- 'echo_twig_assoc ' => new \ Twig_SimpleFunction ('echo_twig_assoc ' , array ($ this , 'getEchoTwigAssoc ' )),
40
- 'echo_twig_filter ' => new \ Twig_SimpleFunction ('echo_twig_filter ' , array ($ this , 'getEchoTwigFilter ' )),
41
- 'echo_include ' => new \ Twig_SimpleFunction ('echo_include ' , array ($ this , 'getEchoInclude ' )),
42
- 'echo_use ' => new \ Twig_SimpleFunction ('echo_use ' , array ($ this , 'getEchoUse ' )),
43
- 'echo_print_block ' => new \ Twig_SimpleFunction ('echo_print_block ' , array ($ this , 'getEchoPrintBlock ' )),
44
- 'char ' => new \ Twig_SimpleFunction ('char ' , array ($ this , 'char ' )),
26
+ 'echo_twig ' => new TwigFunction ('echo_twig ' , array ($ this , 'getEchoTwig ' )),
27
+ 'echo_block ' => new TwigFunction ('echo_block ' , array ($ this , 'getEchoBlock ' )),
28
+ 'echo_endblock ' => new TwigFunction ('echo_endblock ' , array ($ this , 'getEchoEndBlock ' )),
29
+ 'echo_for ' => new TwigFunction ('echo_for ' , array ($ this , 'getEchoFor ' )),
30
+ 'echo_endfor ' => new TwigFunction ('echo_endfor ' , array ($ this , 'getEchoEndFor ' )),
31
+ 'echo_raw ' => new TwigFunction ('echo_raw ' , array ($ this , 'getEchoRaw ' )),
32
+ 'echo_endraw ' => new TwigFunction ('echo_endraw ' , array ($ this , 'getEchoEndRaw ' )),
33
+ 'echo_spaceless ' => new TwigFunction ('echo_spaceless ' , array ($ this , 'getEchoSpaceless ' )),
34
+ 'echo_endspaceless ' => new TwigFunction ('echo_endspaceless ' , array ($ this , 'getEchoEndSpaceless ' )),
35
+ 'echo_extends ' => new TwigFunction ('echo_extends ' , array ($ this , 'getEchoExtends ' )),
36
+ 'echo_if ' => new TwigFunction ('echo_if ' , array ($ this , 'getEchoIf ' )),
37
+ 'echo_else ' => new TwigFunction ('echo_else ' , array ($ this , 'getEchoElse ' )),
38
+ 'echo_elseif ' => new TwigFunction ('echo_elseif ' , array ($ this , 'getEchoElseIf ' )),
39
+ 'echo_endif ' => new TwigFunction ('echo_endif ' , array ($ this , 'getEchoEndIf ' )),
40
+ 'echo_set ' => new TwigFunction ('echo_set ' , array ($ this , 'getEchoSet ' )),
41
+ 'echo_twig_arr ' => new TwigFunction ('echo_twig_arr ' , array ($ this , 'getEchoTwigArr ' )),
42
+ 'echo_twig_assoc ' => new TwigFunction ('echo_twig_assoc ' , array ($ this , 'getEchoTwigAssoc ' )),
43
+ 'echo_twig_filter ' => new TwigFunction ('echo_twig_filter ' , array ($ this , 'getEchoTwigFilter ' )),
44
+ 'echo_include ' => new TwigFunction ('echo_include ' , array ($ this , 'getEchoInclude ' )),
45
+ 'echo_use ' => new TwigFunction ('echo_use ' , array ($ this , 'getEchoUse ' )),
46
+ 'echo_print_block ' => new TwigFunction ('echo_print_block ' , array ($ this , 'getEchoPrintBlock ' )),
47
+ 'char ' => new TwigFunction ('char ' , array ($ this , 'char ' )),
45
48
);
46
49
}
47
50
@@ -289,7 +292,7 @@ public function getEchoEndRaw()
289
292
*/
290
293
public function getEchoSpaceless ()
291
294
{
292
- return '{% spaceless %} ' ;
295
+ return '{% apply spaceless %} ' ;
293
296
}
294
297
295
298
/**
@@ -299,7 +302,7 @@ public function getEchoSpaceless()
299
302
*/
300
303
public function getEchoEndSpaceless ()
301
304
{
302
- return '{% endspaceless %} ' ;
305
+ return '{% endapply %} ' ;
303
306
}
304
307
305
308
/**
0 commit comments