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

[WIP] Kernel refactor #6459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 11, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[TwigBridge] added a render_* function to ease usage of custom render…
…ing 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')) }}
  • Loading branch information
fabpot committed Jan 10, 2013
commit a0c49c3a94e8b5efa1e73eeda147ed1b1d8b06eb
8 changes: 8 additions & 0 deletions 8 src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function getFunctions()
{
return array(
'render' => new \Twig_Function_Method($this, 'render', array('is_safe' => array('html'))),
'render_*' => new \Twig_Function_Method($this, 'renderStrategy', array('is_safe' => array('html'))),
'controller' => new \Twig_Function_Method($this, 'controller'),
);
}
Expand All @@ -56,6 +57,13 @@ public function render($uri, $options = array())
return $this->renderer->render($uri, $options);
}

public function renderStrategy($strategy, $uri, $options = array())
{
$options['strategy'] = $strategy;

return $this->renderer->render($uri, $options);
}

public function controller($controller, $attributes = array(), $query = array())
{
return new ControllerReference($controller, $attributes, $query);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.