Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a0c49c3

Browse filesBrowse files
committed
[TwigBridge] added a render_* function to ease usage of custom rendering strategies
Here is the code you need to write when using the regular render function for an ESI strategy: {{ render(path('path'), { strategy: 'esi' }) }} And the same with the new render_* function: {{ render_esi(path('path')) }}
1 parent 9aaceb1 commit a0c49c3
Copy full SHA for a0c49c3

File tree

1 file changed

+8
-0
lines changed
Filter options

1 file changed

+8
-0
lines changed

‎src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function getFunctions()
3737
{
3838
return array(
3939
'render' => new \Twig_Function_Method($this, 'render', array('is_safe' => array('html'))),
40+
'render_*' => new \Twig_Function_Method($this, 'renderStrategy', array('is_safe' => array('html'))),
4041
'controller' => new \Twig_Function_Method($this, 'controller'),
4142
);
4243
}
@@ -56,6 +57,13 @@ public function render($uri, $options = array())
5657
return $this->renderer->render($uri, $options);
5758
}
5859

60+
public function renderStrategy($strategy, $uri, $options = array())
61+
{
62+
$options['strategy'] = $strategy;
63+
64+
return $this->renderer->render($uri, $options);
65+
}
66+
5967
public function controller($controller, $attributes = array(), $query = array())
6068
{
6169
return new ControllerReference($controller, $attributes, $query);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.