mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-29 20:41:03 +00:00
Merge pull request #6797 from yguedidi/use-twig-instead-of-templating
Use Twig instead of templating
This commit is contained in:
commit
60cb8c0294
3 changed files with 5 additions and 46 deletions
|
@ -23,8 +23,6 @@ framework:
|
||||||
csrf_protection: ~
|
csrf_protection: ~
|
||||||
validation:
|
validation:
|
||||||
enable_annotations: true
|
enable_annotations: true
|
||||||
templating:
|
|
||||||
engines: ['twig']
|
|
||||||
default_locale: "%locale%"
|
default_locale: "%locale%"
|
||||||
trusted_hosts: ~
|
trusted_hosts: ~
|
||||||
session:
|
session:
|
||||||
|
@ -43,7 +41,6 @@ twig:
|
||||||
strict_variables: "%kernel.debug%"
|
strict_variables: "%kernel.debug%"
|
||||||
form_themes:
|
form_themes:
|
||||||
- "@LexikFormFilter/Form/form_div_layout.html.twig"
|
- "@LexikFormFilter/Form/form_div_layout.html.twig"
|
||||||
exception_controller: Wallabag\CoreBundle\Controller\ExceptionController:showAction
|
|
||||||
globals:
|
globals:
|
||||||
registration_enabled: '%fosuser_registration%'
|
registration_enabled: '%fosuser_registration%'
|
||||||
|
|
||||||
|
@ -87,8 +84,13 @@ doctrine_migrations:
|
||||||
executed_at_column_name: 'executed_at'
|
executed_at_column_name: 'executed_at'
|
||||||
|
|
||||||
fos_rest:
|
fos_rest:
|
||||||
|
zone:
|
||||||
|
- { path: ^/api }
|
||||||
|
- { path: ^/annotations }
|
||||||
param_fetcher_listener: true
|
param_fetcher_listener: true
|
||||||
body_listener: true
|
body_listener: true
|
||||||
|
exception:
|
||||||
|
serializer_error_renderer: true
|
||||||
view:
|
view:
|
||||||
mime_types:
|
mime_types:
|
||||||
csv:
|
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/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: "^/api", priorities: ['json', 'xml'], fallback_format: json, prefer_extension: false }
|
||||||
- { path: "^/annotations", 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:
|
nelmio_api_doc:
|
||||||
areas:
|
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