mirror of
https://github.com/wallabag/wallabag.git
synced 2024-10-31 22:28:54 +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
|
@ -23,8 +23,6 @@ framework:
|
|||
csrf_protection: ~
|
||||
validation:
|
||||
enable_annotations: true
|
||||
templating:
|
||||
engines: ['twig']
|
||||
default_locale: "%locale%"
|
||||
trusted_hosts: ~
|
||||
session:
|
||||
|
@ -43,7 +41,6 @@ twig:
|
|||
strict_variables: "%kernel.debug%"
|
||||
form_themes:
|
||||
- "@LexikFormFilter/Form/form_div_layout.html.twig"
|
||||
exception_controller: Wallabag\CoreBundle\Controller\ExceptionController:showAction
|
||||
globals:
|
||||
registration_enabled: '%fosuser_registration%'
|
||||
|
||||
|
@ -87,8 +84,13 @@ doctrine_migrations:
|
|||
executed_at_column_name: 'executed_at'
|
||||
|
||||
fos_rest:
|
||||
zone:
|
||||
- { path: ^/api }
|
||||
- { path: ^/annotations }
|
||||
param_fetcher_listener: true
|
||||
body_listener: true
|
||||
exception:
|
||||
serializer_error_renderer: true
|
||||
view:
|
||||
mime_types:
|
||||
csv:
|
||||
|
@ -117,9 +119,6 @@ fos_rest:
|
|||
- { path: "^/api/entries/([0-9]+)/export.(.*)", priorities: ['epub', 'mobi', 'pdf', 'txt', 'csv'], fallback_format: json, prefer_extension: false }
|
||||
- { path: "^/api", priorities: ['json', 'xml'], fallback_format: json, prefer_extension: false }
|
||||
- { path: "^/annotations", priorities: ['json', 'xml'], fallback_format: json, prefer_extension: false }
|
||||
# for an unknown reason, EACH REQUEST goes to FOS\RestBundle\EventListener\FormatListener
|
||||
# so we need to add custom rule for custom api export but also for all other routes of the application...
|
||||
- { path: '^/', priorities: ['text/html', '*/*'], fallback_format: html, prefer_extension: false }
|
||||
|
||||
nelmio_api_doc:
|
||||
areas:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue