feature #15970 [TwigBundle] removed usage of Templating classes (fabpot)
This PR was merged into the 2.8 branch. Discussion ---------- [TwigBundle] removed usage of Templating classes | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | yes (but frankly, I don't see how that would break anything out there) | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits -------ff3c107
[TwigBundle] removed usage of Templating classes7f13f95
[WebProfilerBundle] fixed a template reference
This commit is contained in:
commit
634aafc3ac
@ -11,12 +11,10 @@
|
||||
|
||||
namespace Symfony\Bundle\TwigBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
|
||||
use Symfony\Component\HttpKernel\Exception\FlattenException;
|
||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Templating\TemplateReferenceInterface;
|
||||
|
||||
/**
|
||||
* ExceptionController renders error or exception pages for a given
|
||||
@ -96,7 +94,7 @@ class ExceptionController
|
||||
* @param int $code An HTTP response status code
|
||||
* @param bool $showException
|
||||
*
|
||||
* @return TemplateReferenceInterface
|
||||
* @return string
|
||||
*/
|
||||
protected function findTemplate(Request $request, $format, $code, $showException)
|
||||
{
|
||||
@ -107,14 +105,14 @@ class ExceptionController
|
||||
|
||||
// For error pages, try to find a template for the specific HTTP status code and format
|
||||
if (!$showException) {
|
||||
$template = new TemplateReference('TwigBundle', 'Exception', $name.$code, $format, 'twig');
|
||||
$template = sprintf('@Twig/Exception/%s%s.%s.twig', $name, $code, $format);
|
||||
if ($this->templateExists($template)) {
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
||||
// try to find a template for the given format
|
||||
$template = new TemplateReference('TwigBundle', 'Exception', $name, $format, 'twig');
|
||||
$template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format);
|
||||
if ($this->templateExists($template)) {
|
||||
return $template;
|
||||
}
|
||||
@ -122,7 +120,7 @@ class ExceptionController
|
||||
// default to a generic HTML exception
|
||||
$request->setRequestFormat('html');
|
||||
|
||||
return new TemplateReference('TwigBundle', 'Exception', $showException ? 'exception_full' : $name, 'html', 'twig');
|
||||
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
|
||||
}
|
||||
|
||||
// to be removed when the minimum required version of Twig is >= 3.0
|
||||
|
@ -1 +1 @@
|
||||
{% include 'TwigBundle:Exception:error.xml.twig' %}
|
||||
{% include '@Twig/Exception/error.xml.twig' %}
|
||||
|
@ -1 +1 @@
|
||||
{% include 'TwigBundle:Exception:error.xml.twig' %}
|
||||
{% include '@Twig/Exception/error.xml.twig' %}
|
||||
|
@ -1 +1 @@
|
||||
{% include 'TwigBundle:Exception:exception.xml.twig' with { 'exception': exception } %}
|
||||
{% include '@Twig/Exception/exception.xml.twig' with { 'exception': exception } %}
|
||||
|
@ -1,3 +1,3 @@
|
||||
/*
|
||||
{% include 'TwigBundle:Exception:exception.txt.twig' with { 'exception': exception } %}
|
||||
{% include '@Twig/Exception/exception.txt.twig' with { 'exception': exception } %}
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@
|
||||
</div>
|
||||
|
||||
{% for position, e in exception.toarray %}
|
||||
{% include 'TwigBundle:Exception:traces.html.twig' with { 'exception': e, 'position': position, 'count': previous_count } only %}
|
||||
{% include '@Twig/Exception/traces.html.twig' with { 'exception': e, 'position': position, 'count': previous_count } only %}
|
||||
{% endfor %}
|
||||
|
||||
{% if logger %}
|
||||
@ -63,7 +63,7 @@
|
||||
</div>
|
||||
|
||||
<div id="logs">
|
||||
{% include 'TwigBundle:Exception:logs.html.twig' with { 'logs': logger.logs } only %}
|
||||
{% include '@Twig/Exception/logs.html.twig' with { 'logs': logger.logs } only %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -88,7 +88,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include 'TwigBundle:Exception:traces_text.html.twig' with { 'exception': exception } only %}
|
||||
{% include '@Twig/Exception/traces_text.html.twig' with { 'exception': exception } only %}
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function toggle(id, clazz) {
|
||||
|
@ -1,3 +1,3 @@
|
||||
/*
|
||||
{% include 'TwigBundle:Exception:exception.txt.twig' with { 'exception': exception } %}
|
||||
{% include '@Twig/Exception/exception.txt.twig' with { 'exception': exception } %}
|
||||
*/
|
||||
|
@ -1 +1 @@
|
||||
{% include 'TwigBundle:Exception:exception.xml.twig' with { 'exception': exception } %}
|
||||
{% include '@Twig/Exception/exception.xml.twig' with { 'exception': exception } %}
|
||||
|
@ -2,6 +2,6 @@
|
||||
[message] {{ exception.message }}
|
||||
{% for i, e in exception.toarray %}
|
||||
[{{ i + 1 }}] {{ e.class }}: {{ e.message }}
|
||||
{% include 'TwigBundle:Exception:traces.txt.twig' with { 'exception': e } only %}
|
||||
{% include '@Twig/Exception/traces.txt.twig' with { 'exception': e } only %}
|
||||
|
||||
{% endfor %}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<error code="{{ status_code }}" message="{{ status_text }}">
|
||||
{% for e in exception.toarray %}
|
||||
<exception class="{{ e.class }}" message="{{ e.message }}">
|
||||
{% include 'TwigBundle:Exception:traces.xml.twig' with { 'exception': e } only %}
|
||||
{% include '@Twig/Exception/traces.xml.twig' with { 'exception': e } only %}
|
||||
</exception>
|
||||
{% endfor %}
|
||||
</error>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'TwigBundle::layout.html.twig' %}
|
||||
{% extends '@Twig/layout.html.twig' %}
|
||||
|
||||
{% block head %}
|
||||
<link href="{{ absolute_url(asset('bundles/framework/css/exception.css')) }}" rel="stylesheet" type="text/css" media="all" />
|
||||
@ -9,5 +9,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'TwigBundle:Exception:exception.html.twig' %}
|
||||
{% include '@Twig/Exception/exception.html.twig' %}
|
||||
{% endblock %}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<ol class="traces list-exception" id="traces-{{ position }}" style="display: {{ 0 == count ? 'block' : 'none' }}">
|
||||
{% for i, trace in exception.trace %}
|
||||
<li>
|
||||
{% include 'TwigBundle:Exception:trace.html.twig' with { 'prefix': position, 'i': i, 'trace': trace } only %}
|
||||
{% include '@Twig/Exception/trace.html.twig' with { 'prefix': position, 'i': i, 'trace': trace } only %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% if exception.trace|length %}
|
||||
{% for trace in exception.trace %}
|
||||
{% include 'TwigBundle:Exception:trace.txt.twig' with { 'trace': trace } only %}
|
||||
{% include '@Twig/Exception/trace.txt.twig' with { 'trace': trace } only %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<traces>
|
||||
{% for trace in exception.trace %}
|
||||
<trace>
|
||||
{% include 'TwigBundle:Exception:trace.txt.twig' with { 'trace': trace } only %}
|
||||
{% include '@Twig/Exception/trace.txt.twig' with { 'trace': trace } only %}
|
||||
|
||||
</trace>
|
||||
{% endfor %}
|
||||
|
@ -12,7 +12,7 @@
|
||||
<div id="traces-text" class="trace" style="display: none;">
|
||||
<pre>{% for i, e in exception.toarray %}
|
||||
[{{ i + 1 }}] {{ e.class }}: {{ e.message }}
|
||||
{% include 'TwigBundle:Exception:traces.txt.twig' with { 'exception': e } only %}
|
||||
{% include '@Twig/Exception/traces.txt.twig' with { 'exception': e } only %}
|
||||
{% endfor %}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -47,7 +47,7 @@ class ExceptionControllerTest extends TestCase
|
||||
{
|
||||
$twig = new \Twig_Environment(
|
||||
new \Twig_Loader_Array(array(
|
||||
'TwigBundle:Exception:error404.html.twig' => 'ok',
|
||||
'@Twig/Exception/error404.html.twig' => 'ok',
|
||||
))
|
||||
);
|
||||
|
||||
@ -67,7 +67,7 @@ class ExceptionControllerTest extends TestCase
|
||||
{
|
||||
$twig = new \Twig_Environment(
|
||||
new \Twig_Loader_Array(array(
|
||||
'TwigBundle:Exception:error.html.twig' => 'html',
|
||||
'@Twig/Exception/error.html.twig' => 'html',
|
||||
))
|
||||
);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'TwigBundle::layout.html.twig' %}
|
||||
{% extends '@Twig/layout.html.twig' %}
|
||||
|
||||
{% block title 'Redirection Intercepted' %}
|
||||
|
||||
|
Reference in New Issue
Block a user