Use twig instead of templating engine to render about page

This restores compatibility with Contao 4.8 without changing default
configuration of the symfony framework bundle.
This commit is contained in:
David Molineus
2019-08-21 13:27:11 +02:00
parent 06dd3655c0
commit cef9d7ff44
4 changed files with 22 additions and 13 deletions

View File

@@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.1.5] - 2019-08-21
### Fixed
- Use twig directly instead of templating component to restore Contao 4.8
## [3.1.4] - 2019-02-13 ## [3.1.4] - 2019-02-13
### Fixed ### Fixed

View File

@@ -36,8 +36,9 @@
"symfony/event-dispatcher": "~3.3 || ~4.0", "symfony/event-dispatcher": "~3.3 || ~4.0",
"symfony/filesystem": "~3.3 || ~4.0", "symfony/filesystem": "~3.3 || ~4.0",
"symfony/http-kernel": "~3.3 || ~4.0", "symfony/http-kernel": "~3.3 || ~4.0",
"symfony/templating": "~3.3 || ~4.0", "symfony/twig-bundle": "~3.3 || ~4.0",
"symfony/translation": "~3.3 || ~4.0" "symfony/translation": "~3.3 || ~4.0",
"twig/twig": "^1.3.35 || ^2.0",
}, },
"require-dev": { "require-dev": {
"contao/manager-plugin": "^2.1", "contao/manager-plugin": "^2.1",

View File

@@ -5,15 +5,15 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @copyright 2014-2019 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
namespace Netzmacht\Contao\Leaflet\Backend\Action; namespace Netzmacht\Contao\Leaflet\Backend\Action;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface as Engine;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
/** /**
* Credits backend module. * Credits backend module.
@@ -23,11 +23,11 @@ use Symfony\Component\HttpFoundation\Response;
final class AboutAction final class AboutAction
{ {
/** /**
* Templating engine. * Twig environment.
* *
* @var Engine * @var Environment
*/ */
private $engine; private $twig;
/** /**
* Project directory. * Project directory.
@@ -39,12 +39,12 @@ final class AboutAction
/** /**
* AboutAction constructor. * AboutAction constructor.
* *
* @param Engine $engine Templating engine. * @param Environment $twig Twig environment.
* @param string $projectDir Project directory. * @param string $projectDir Project directory.
*/ */
public function __construct(Engine $engine, string $projectDir) public function __construct(Environment $twig, string $projectDir)
{ {
$this->engine = $engine; $this->twig = $twig;
$this->projectDir = $projectDir; $this->projectDir = $projectDir;
} }
@@ -62,7 +62,9 @@ final class AboutAction
[$data['version'], $data['dependencies']] = $this->extractFromComposer(); [$data['version'], $data['dependencies']] = $this->extractFromComposer();
return $this->engine->renderResponse('@NetzmachtContaoLeaflet/backend/about.html.twig', $data); return new Response(
$this->twig->render('@NetzmachtContaoLeaflet/backend/about.html.twig', $data)
);
} }
/** /**

View File

@@ -136,5 +136,5 @@ services:
Netzmacht\Contao\Leaflet\Backend\Action\AboutAction: Netzmacht\Contao\Leaflet\Backend\Action\AboutAction:
public: true public: true
arguments: arguments:
- '@templating' - '@twig'
- '%kernel.project_dir%' - '%kernel.project_dir%'