mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-06 17:41:01 +00:00
Use Twig instead of templating
This commit is contained in:
parent
c2bfc0f359
commit
e93fdca2d3
3 changed files with 5 additions and 46 deletions
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\TwigBundle\Controller\ExceptionController as BaseExceptionController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* This controller allow us to customize the error template.
|
||||
* The only modified line from the parent template is for "WallabagCoreBundle".
|
||||
*/
|
||||
class ExceptionController extends BaseExceptionController
|
||||
{
|
||||
protected function findTemplate(Request $request, $format, $code, $showException)
|
||||
{
|
||||
$name = $showException ? 'exception' : 'error';
|
||||
if ($showException && 'html' === $format) {
|
||||
$name = 'exception_full';
|
||||
}
|
||||
|
||||
// For error pages, try to find a template for the specific HTTP status code and format
|
||||
if (!$showException) {
|
||||
$template = sprintf('@WallabagCore/Exception/%s.%s.twig', $name, $format);
|
||||
if ($this->templateExists($template)) {
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
||||
// try to find a template for the given format
|
||||
$template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format);
|
||||
if ($this->templateExists($template)) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
// default to a generic HTML exception
|
||||
$request->setRequestFormat('html');
|
||||
|
||||
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{% extends "@WallabagCore/layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ 'error.page_title'|trans }}{% endblock %}
|
||||
|
||||
{% block body_class %}login{% endblock %}
|
||||
|
||||
{% block menu %}{% endblock %}
|
||||
{% block messages %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<main class="valign-wrapper">
|
||||
<div class="valign row">
|
||||
<div class="card sw">
|
||||
<div class="center"><img src="{{ asset('img/logo-wallabag.svg') }}" alt="wallabag logo" class="typo-logo" /></div>
|
||||
<div class="card-content">
|
||||
<div class="row">
|
||||
<h5>{{ status_code }}: {{ status_text }}</h5>
|
||||
<p>{{ exception.message }}</p>
|
||||
{# {% for trace in exception.trace %}
|
||||
<p>{{ trace.class }} - {{ trace.type }} - {{ trace.file }} - {{ trace.line }}</p>
|
||||
{% endfor %} #}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue