Merge branch '2.7' into 2.8
* 2.7: Show exception is checked twice in ExceptionController of twig allow SSI fragments configuration in XML files Display a better error message when the toolbar cannot be displayed render hidden _method field in form_rest() return fallback locales whenever possible
This commit is contained in:
commit
b4aa0271cb
@ -267,6 +267,7 @@
|
||||
{%- endblock form -%}
|
||||
|
||||
{%- block form_start -%}
|
||||
{%- do form.setMethodRendered() -%}
|
||||
{% set method = method|upper %}
|
||||
{%- if method in ["GET", "POST"] -%}
|
||||
{% set form_method = method %}
|
||||
@ -306,6 +307,20 @@
|
||||
{{- form_row(child) -}}
|
||||
{% endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{% if not form.methodRendered %}
|
||||
{%- do form.setMethodRendered() -%}
|
||||
{% set method = method|upper %}
|
||||
{%- if method in ["GET", "POST"] -%}
|
||||
{% set form_method = method %}
|
||||
{%- else -%}
|
||||
{% set form_method = "POST" %}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if form_method != method -%}
|
||||
<input type="hidden" name="_method" value="{{ method }}" />
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{% endblock form_rest %}
|
||||
|
||||
{# Support #}
|
||||
|
@ -22,7 +22,7 @@
|
||||
"require-dev": {
|
||||
"symfony/asset": "~2.7|~3.0.0",
|
||||
"symfony/finder": "~2.3|~3.0.0",
|
||||
"symfony/form": "^2.8.19",
|
||||
"symfony/form": "^2.8.23",
|
||||
"symfony/http-kernel": "~2.8|~3.0.0",
|
||||
"symfony/polyfill-intl-icu": "~1.0",
|
||||
"symfony/routing": "~2.2|~3.0.0",
|
||||
@ -36,6 +36,9 @@
|
||||
"symfony/var-dumper": "~2.7.16|~2.8.9|~3.0.9",
|
||||
"symfony/expression-language": "~2.4|~3.0.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/form": "<2.8.23"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/finder": "",
|
||||
"symfony/asset": "For using the AssetExtension",
|
||||
|
@ -22,6 +22,7 @@
|
||||
<xsd:element name="form" type="form" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="csrf-protection" type="csrf_protection" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="esi" type="esi" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="ssi" type="ssi" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="fragments" type="fragments" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="profiler" type="profiler" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="router" type="router" minOccurs="0" maxOccurs="1" />
|
||||
@ -65,6 +66,10 @@
|
||||
<xsd:attribute name="enabled" type="xsd:boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ssi">
|
||||
<xsd:attribute name="enabled" type="xsd:boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="fragments">
|
||||
<xsd:attribute name="enabled" type="xsd:boolean" />
|
||||
<xsd:attribute name="path" type="xsd:string" />
|
||||
|
@ -16,6 +16,9 @@ $container->loadFromExtension('framework', array(
|
||||
'esi' => array(
|
||||
'enabled' => true,
|
||||
),
|
||||
'ssi' => array(
|
||||
'enabled' => true,
|
||||
),
|
||||
'profiler' => array(
|
||||
'only_exceptions' => true,
|
||||
'enabled' => false,
|
||||
|
@ -12,6 +12,7 @@
|
||||
<framework:csrf-protection field-name="_csrf"/>
|
||||
</framework:form>
|
||||
<framework:esi enabled="true" />
|
||||
<framework:ssi enabled="true" />
|
||||
<framework:profiler only-exceptions="true" enabled="false" />
|
||||
<framework:router resource="%kernel.root_dir%/config/routing.xml" type="xml" />
|
||||
<framework:session gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="false" use-cookies="true" save-path="/path/to/sessions" />
|
||||
|
@ -10,6 +10,8 @@ framework:
|
||||
enabled: true
|
||||
esi:
|
||||
enabled: true
|
||||
ssi:
|
||||
enabled: true
|
||||
profiler:
|
||||
only_exceptions: true
|
||||
enabled: false
|
||||
|
@ -99,6 +99,13 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertTrue($container->hasDefinition('esi'), '->registerEsiConfiguration() loads esi.xml');
|
||||
}
|
||||
|
||||
public function testSsi()
|
||||
{
|
||||
$container = $this->createContainerFromFile('full');
|
||||
|
||||
$this->assertTrue($container->hasDefinition('ssi'), '->registerSsiConfiguration() loads ssi.xml');
|
||||
}
|
||||
|
||||
public function testEnabledProfiler()
|
||||
{
|
||||
$container = $this->createContainerFromFile('profiler');
|
||||
|
@ -123,7 +123,7 @@ class ExceptionController
|
||||
// default to a generic HTML exception
|
||||
$request->setRequestFormat('html');
|
||||
|
||||
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
|
||||
return sprintf('@Twig/Exception/%s.html.twig', $name);
|
||||
}
|
||||
|
||||
// to be removed when the minimum required version of Twig is >= 3.0
|
||||
|
@ -60,8 +60,17 @@
|
||||
}
|
||||
},
|
||||
function(xhr) {
|
||||
var errorToolbarHtml = '
|
||||
<style>
|
||||
.sfErrorToolbar { background: #222; bottom: 0; color: #f5f5f5; font: 13px/36px Arial, sans-serif; height: 36px; padding: 0 15px; position: fixed; width: 100%; }
|
||||
.sfErrorToolbar a { color: #99cdd8; margin-left: 5px; text-decoration: underline; }
|
||||
.sfErrorToolbar a:hover { text-decoration: none; }
|
||||
</style>
|
||||
<div class="sfErrorToolbar">An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a></div>
|
||||
';
|
||||
|
||||
if (xhr.status !== 0) {
|
||||
confirm('An error occurred while loading the web debug toolbar (' + xhr.status + ': ' + xhr.statusText + ').\n\nDo you want to open the profiler?') && (window.location = '{{ path("_profiler", { "token": token }) }}');
|
||||
window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml);
|
||||
}
|
||||
},
|
||||
{'maxTries': 5}
|
||||
|
@ -53,6 +53,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
*/
|
||||
private $rendered = false;
|
||||
|
||||
private $methodRendered = false;
|
||||
|
||||
public function __construct(FormView $parent = null)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
@ -90,6 +92,19 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isMethodRendered()
|
||||
{
|
||||
return $this->methodRendered;
|
||||
}
|
||||
|
||||
public function setMethodRendered()
|
||||
{
|
||||
$this->methodRendered = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a child by name (implements \ArrayAccess).
|
||||
*
|
||||
|
@ -95,7 +95,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
|
||||
*/
|
||||
public function getFallbackLocales()
|
||||
{
|
||||
if ($this->translator instanceof Translator) {
|
||||
if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
|
||||
return $this->translator->getFallbackLocales();
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
||||
*/
|
||||
public function getFallbackLocales()
|
||||
{
|
||||
if ($this->translator instanceof Translator) {
|
||||
if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
|
||||
return $this->translator->getFallbackLocales();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user