Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit fcec18c

Browse files
committed
Merge pull request #274 from symfony-cmf/error_pages
Sync error page with core
2 parents 727f930 + 9a38fa3 commit fcec18c

File tree

7 files changed

+44
-18
lines changed

7 files changed

+44
-18
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cache:
1616

1717
env:
1818
global:
19-
- SYMFONY_DEPRECATIONS_HELPER=302
19+
- SYMFONY_DEPRECATIONS_HELPER=286
2020

2121
matrix:
2222
include:

DependencyInjection/Configuration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ private function addErrorHandlerSection(NodeBuilder $nodeBuilder)
182182
->fixXmlConfig('template')
183183
->fixXmlConfig('exclusion_rule')
184184
->children()
185-
->scalarNode('enable_parent_provider')->defaultValue(false)->end()
186-
->scalarNode('enable_sibling_provider')->defaultValue(false)->end()
185+
->booleanNode('enable_parent_provider')->defaultFalse()->end()
186+
->booleanNode('enable_sibling_provider')->defaultFalse()->end()
187187
->arrayNode('templates')
188188
->useAttributeAsKey('format')
189189
->requiresAtLeastOneElement()
190-
->defaultValue(array('html' => 'CmfSeoBundle:Exception:exception.html.twig'))
190+
->defaultValue(array('html' => 'CmfSeoBundle:Exception:error.html.twig'))
191191
->prototype('scalar')->end()
192192
->end()
193193
->arrayNode('exclusion_rules')

Resources/config/schema/seo-1.0.xsd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
</xsd:complexType>
2828

2929
<xsd:complexType name="persistence">
30+
<xsd:all minOccurs="0">
31+
<xsd:element name="phpcr" type="persistence_layer" />
32+
<xsd:element name="orm" type="persistence_layer" />
33+
</xsd:all>
34+
3035
<xsd:attribute name="phpcr" type="xsd:boolean" />
3136
<xsd:attribute name="orm" type="xsd:boolean" />
3237
</xsd:complexType>
@@ -128,4 +133,8 @@
128133
<xsd:attribute name="host" type="xsd:string" />
129134
<xsd:attribute name="methods" type="xsd:string" />
130135
</xsd:complexType>
136+
137+
<xsd:complexType name="persistence_layer">
138+
<xsd:attribute name="manager-name" type="xsd:string"/>
139+
</xsd:complexType>
131140
</xsd:schema>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="{{ _charset }}" />
5+
<title>An Error Occurred: {{ status_text }}</title>
6+
</head>
7+
<body>
8+
<h1>Oops! An Error Occurred</h1>
9+
<h2>The server returned a "{{ status_code }} {{ status_text }}".</h2>
10+
11+
<p>
12+
Something is broken. Please let us know what you were doing when this error occurred.
13+
We will fix it as soon as possible. Sorry for any inconvenience caused.
14+
</p>
15+
16+
{% if best_matches not is empty %}
17+
<h3>Suggested pages</h3>
18+
19+
{% for group, matches in best_matches %}
20+
<h4>{{ group|capitalize }}</h4>
21+
<ul>
22+
{% for match in matches %}
23+
<li><a href="{{ path(match.name) }}">{{ match.name }}</a></li>
24+
{% endfor %}
25+
</ul>
26+
{% endfor %}
27+
{% endif %}
28+
</body>
29+
</html>

Resources/views/Exception/exception.html.twig

Lines changed: 0 additions & 12 deletions
This file was deleted.

Tests/Unit/DependencyInjection/CmfSeoExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function testErrorHandlingPHPCR()
246246

247247
$this->assertContainerBuilderHasParameter(
248248
'cmf_seo.error.templates',
249-
array('html' => 'CmfSeoBundle:Exception:exception.html.twig')
249+
array('html' => 'CmfSeoBundle:Exception:error.html.twig')
250250
);
251251

252252
$this->assertContainerBuilderHasService(

Tests/Unit/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function testErrorHandlingXmlConfigurations()
185185
),
186186
),
187187
'templates' => array(
188-
'html' => 'CmfSeoBundle:Exception:exception.html.twig',
188+
'html' => 'CmfSeoBundle:Exception:error.html.twig',
189189
),
190190
),
191191
'translation_domain' => 'messages',

0 commit comments

Comments
 (0)