From 4bed32348b4b950239bb93d51bedea2688d19722 Mon Sep 17 00:00:00 2001 From: Ingolf Steinhardt Date: Wed, 22 Jul 2026 22:15:01 +0200 Subject: [PATCH 1/3] Remove obsolete _dcg_referer_update route flag The flag was only read by dc-general's StoreRefererListener, which is removed for Contao 5.7 (System::getReferer() no longer uses the session referer). It no longer has any effect. --- src/CoreBundle/Resources/config/routing.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CoreBundle/Resources/config/routing.yml b/src/CoreBundle/Resources/config/routing.yml index 46d10d0d3..8648758c0 100644 --- a/src/CoreBundle/Resources/config/routing.yml +++ b/src/CoreBundle/Resources/config/routing.yml @@ -1,6 +1,6 @@ metamodels.inputscreen.add_all: path: /%contao.backend.route_prefix%/metamodels/inputscreen/add-all/{metaModel}/{inputScreen} - defaults: { _controller: metamodels.controller.inputscreen.add_all, _scope: backend, _dcg_referer_update: true, _token_check: true } + defaults: { _controller: metamodels.controller.inputscreen.add_all, _scope: backend, _token_check: true } metamodels.support_screen: path: /%contao.backend.route_prefix%/metamodels/support @@ -8,14 +8,13 @@ metamodels.support_screen: metamodels.rendersetting.add_all: path: /%contao.backend.route_prefix%/metamodels/rendersetting/add-all/{metaModel}/{renderSetting} - defaults: { _controller: metamodels.controller.rendersetting.add_all, _scope: backend, _dcg_referer_update: true, _token_check: true } + defaults: { _controller: metamodels.controller.rendersetting.add_all, _scope: backend, _token_check: true } metamodels.configuration: path: /%contao.backend.route_prefix%/metamodels/{tableName} defaults: _controller: MetaModels\CoreBundle\Controller\Backend\ConfigurationController _scope: backend - _dcg_referer_update: true _token_check: true tableName: ~ @@ -24,5 +23,4 @@ metamodels.metamodel: defaults: _controller: MetaModels\CoreBundle\Controller\Backend\MetaModelController _scope: backend - _dcg_referer_update: true _token_check: true From 79a6c5d3b37789d64075e611d309c323ddbbe5c5 Mon Sep 17 00:00:00 2001 From: Ingolf Steinhardt Date: Thu, 23 Jul 2026 09:37:50 +0200 Subject: [PATCH 2/3] Remove orphaned saveNback translations The "Save and go back" (saveNback) button was removed from dc-general (following Contao core 5.7.0). These per-table label overrides are no longer used. --- src/CoreBundle/Resources/translations/tl_metamodel.de.xlf | 4 ---- src/CoreBundle/Resources/translations/tl_metamodel.en.xlf | 3 --- src/CoreBundle/Resources/translations/tl_metamodel.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_attribute.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_attribute.en.xlf | 3 --- .../Resources/translations/tl_metamodel_attribute.fr.xlf | 4 ---- src/CoreBundle/Resources/translations/tl_metamodel_dca.de.xlf | 4 ---- src/CoreBundle/Resources/translations/tl_metamodel_dca.en.xlf | 3 --- src/CoreBundle/Resources/translations/tl_metamodel_dca.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_dca_combine.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_dca_combine.en.xlf | 3 --- .../Resources/translations/tl_metamodel_dca_combine.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_dca_sortgroup.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_dca_sortgroup.en.xlf | 3 --- .../Resources/translations/tl_metamodel_dca_sortgroup.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_dcasetting.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_dcasetting.en.xlf | 3 --- .../Resources/translations/tl_metamodel_dcasetting.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_filter.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_filter.en.xlf | 3 --- .../Resources/translations/tl_metamodel_filter.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_filtersetting.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_filtersetting.en.xlf | 3 --- .../Resources/translations/tl_metamodel_filtersetting.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_item.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_item.en.xlf | 3 --- .../Resources/translations/tl_metamodel_item.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_rendersetting.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_rendersetting.en.xlf | 3 --- .../Resources/translations/tl_metamodel_rendersetting.fr.xlf | 4 ---- .../Resources/translations/tl_metamodel_rendersettings.de.xlf | 4 ---- .../Resources/translations/tl_metamodel_rendersettings.en.xlf | 3 --- .../Resources/translations/tl_metamodel_rendersettings.fr.xlf | 4 ---- 33 files changed, 121 deletions(-) diff --git a/src/CoreBundle/Resources/translations/tl_metamodel.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel.de.xlf index d24f0a85e..85100b313 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel.de.xlf @@ -299,10 +299,6 @@ Save and new Speichern und neu - - Save and go back - Speichern und zurück - The table name is not given or empty. Der Tabellenname wurde nicht gesetzt oder ist leer. diff --git a/src/CoreBundle/Resources/translations/tl_metamodel.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel.en.xlf index 0c3471345..7ecc40145 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel.en.xlf @@ -226,9 +226,6 @@ Save and new - - Save and go back - The table name is not given or empty. diff --git a/src/CoreBundle/Resources/translations/tl_metamodel.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel.fr.xlf index 7b55dd32b..a84b68c9c 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel.fr.xlf @@ -299,10 +299,6 @@ Save and new Enregistrer et nouveau - - Save and go back - Enregistrer et retour - The table name is not given or empty. Le nom de la table n'est pas autorisé ou est vide. diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_attribute.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_attribute.de.xlf index 3315a7a9d..bf29e0a12 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_attribute.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_attribute.de.xlf @@ -241,10 +241,6 @@ Save and new Speichern und neu - - Save and go back - Speichern und zurück - Column "%col_name%" already exists on table "%table_name%". Die Spalte "%col_name%" ist in der Tabelle "%table_name%" bereits vorhanden. diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_attribute.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_attribute.en.xlf index 9692bcea6..6badc85de 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_attribute.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_attribute.en.xlf @@ -184,9 +184,6 @@ Save and new - - Save and go back - Column "%col_name%" already exists on table "%table_name%". diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_attribute.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_attribute.fr.xlf index 6604dbe4d..929b63523 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_attribute.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_attribute.fr.xlf @@ -238,10 +238,6 @@ En cas de modification du nom de la colonne, les données de l'utilisateur Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - Column "%col_name%" already exists on table "%table_name%". La colonne «%col_name% » existe déjà dans la table «%table_name% ». diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca.de.xlf index d5fa4c126..659bb6761 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca.de.xlf @@ -61,10 +61,6 @@ Save and new Speichern und neu - - Save and go back - Speichern und zurück - Go back Zurück diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca.en.xlf index bbad441d8..a6fb5be8f 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca.en.xlf @@ -48,9 +48,6 @@ Save and new - - Save and go back - Go back diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca.fr.xlf index 4e2035f8b..a78c5c03c 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca.fr.xlf @@ -61,10 +61,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - Go back diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.de.xlf index db9681bbc..879de9887 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.de.xlf @@ -17,10 +17,6 @@ Save and new Speichern und neu - - Save and go back - Speichern und zurück - Go back Zurück diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.en.xlf index 4e9fe501c..56779f686 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.en.xlf @@ -15,9 +15,6 @@ Save and new - - Save and go back - Go back diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.fr.xlf index ae70bf2cd..7bb28185b 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca_combine.fr.xlf @@ -16,10 +16,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - Go back diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.de.xlf index 603e50a15..b40c085ac 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.de.xlf @@ -77,10 +77,6 @@ Save and new Speichern und Neu - - Save and go back - Speichern und zurück - Edit record %id% Datensatz %id% bearbeiten diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.en.xlf index dab68c5c4..b758ff116 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.en.xlf @@ -60,9 +60,6 @@ Save and new - - Save and go back - Edit record %id% diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.fr.xlf index cfdc11f70..e9abb809d 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dca_sortgroup.fr.xlf @@ -61,10 +61,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - Edit record %id% diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.de.xlf index ea8718164..e54548096 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.de.xlf @@ -105,10 +105,6 @@ Save and new Speichern und Neu - - Save and go back - Speichern und zurück - Continue Fortfahren diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.en.xlf index afa148e6c..75d320b8d 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.en.xlf @@ -81,9 +81,6 @@ Save and new - - Save and go back - Continue diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.fr.xlf index ece488cf3..f2504971e 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_dcasetting.fr.xlf @@ -82,10 +82,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - Continue diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_filter.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_filter.de.xlf index 82e959f32..0d0bca3a4 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_filter.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_filter.de.xlf @@ -25,10 +25,6 @@ Save and new Speichern und neu - - Save and go back - Speichern und zurück - Edit record %id% Datensatz %id% bearbeiten diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_filter.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_filter.en.xlf index 11b2236d3..d958cd2df 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_filter.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_filter.en.xlf @@ -21,9 +21,6 @@ Save and new - - Save and go back - Edit record %id% diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_filter.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_filter.fr.xlf index 1ecaf1443..e97272ee1 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_filter.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_filter.fr.xlf @@ -25,10 +25,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - Edit record %id% diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.de.xlf index 0b606f55a..885f3702b 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.de.xlf @@ -505,10 +505,6 @@ erste Filterregel ausgeführt; ist dies nicht der Fall, wird die zweite ausgefü Save and new Speichern und neu - - Save and go back - Speichern und zurück - Abstract Zusammenfassung diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.en.xlf index 86c4ad18e..7fff10419 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.en.xlf @@ -383,9 +383,6 @@ Save and new - - Save and go back - Abstract diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.fr.xlf index 19e7337ec..4c16d815c 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_filtersetting.fr.xlf @@ -418,10 +418,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - Abstract diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_item.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_item.de.xlf index 4fc6d02c3..92e94e087 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_item.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_item.de.xlf @@ -186,10 +186,6 @@ Save and new Speichern und Neu - - Save and go back - Speichern und zurück - \ No newline at end of file diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_item.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_item.en.xlf index 25e2a41e9..2e2743af6 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_item.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_item.en.xlf @@ -142,9 +142,6 @@ Save and new - - Save and go back - diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_item.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_item.fr.xlf index ea79768eb..19e55956b 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_item.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_item.fr.xlf @@ -186,10 +186,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - \ No newline at end of file diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.de.xlf index 584577a65..a79892801 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.de.xlf @@ -81,10 +81,6 @@ Save and new Speichern und neu - - Save and go back - Speichern und zurück - Edit record %id% Datensatz %id% bearbeiten diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.en.xlf index 092c7fe98..b4629d0f7 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.en.xlf @@ -63,9 +63,6 @@ Save and new - - Save and go back - Edit record %id% diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.fr.xlf index 41038cb76..4e2703a0b 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_rendersetting.fr.xlf @@ -64,10 +64,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - Edit record %id% diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.de.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.de.xlf index 322128a73..c092d1c82 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.de.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.de.xlf @@ -309,10 +309,6 @@ Save and new Speichern und Neu - - Save and go back - Speichern und zurück - \ No newline at end of file diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.en.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.en.xlf index 5147cad20..afa29302a 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.en.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.en.xlf @@ -235,9 +235,6 @@ Save and new - - Save and go back - diff --git a/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.fr.xlf b/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.fr.xlf index 9edaa4841..ed02775ca 100644 --- a/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.fr.xlf +++ b/src/CoreBundle/Resources/translations/tl_metamodel_rendersettings.fr.xlf @@ -241,10 +241,6 @@ Save and new Sauvegarder et nouveau - - Save and go back - Sauvegarder et retour - \ No newline at end of file From 58c0811a3c1feccb5893d0e7bd8dcd3b139ba441 Mon Sep 17 00:00:00 2001 From: Ingolf Steinhardt Date: Thu, 23 Jul 2026 10:07:18 +0200 Subject: [PATCH 3/3] Build add-all back URL deterministically for Contao 5.7 System::getReferer() no longer resolves dc-general/MetaModels views in Contao 5.7 (it uses DcaUrlAnalyzer, which does not know the MetaModels tables), so the add-all "back" link and the "save and close" redirect pointed at the backend home instead of the settings list. Build the URL from the settings table and its parent id instead, and drop the now unused Contao System adapter dependency. --- .../Backend/AbstractAddAllController.php | 73 ++++++++++--------- .../Backend/InputScreenAddAllController.php | 15 ++-- src/CoreBundle/Resources/config/services.yml | 1 - 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/src/CoreBundle/Controller/Backend/AbstractAddAllController.php b/src/CoreBundle/Controller/Backend/AbstractAddAllController.php index 50ce7b230..46e6609f5 100644 --- a/src/CoreBundle/Controller/Backend/AbstractAddAllController.php +++ b/src/CoreBundle/Controller/Backend/AbstractAddAllController.php @@ -24,7 +24,6 @@ use Contao\CoreBundle\Controller\Backend\AbstractBackendController; use Contao\CoreBundle\Csrf\ContaoCsrfTokenManager; -use Contao\CoreBundle\Framework\Adapter; use Contao\System; use Doctrine\DBAL\Connection; use MetaModels\Attribute\IAttribute; @@ -34,6 +33,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment as TwigEnvironment; @@ -46,13 +46,6 @@ */ abstract class AbstractAddAllController extends AbstractBackendController { - /** - * Adapter to the Contao\System class. - * - * @var Adapter - */ - private Adapter $systemAdapter; - /** * The translator. * @@ -109,7 +102,6 @@ abstract class AbstractAddAllController extends AbstractBackendController * @param TranslatorInterface $translator The translator. * @param IFactory $factory The MetaModels factory. * @param Connection $connection The database connection. - * @param Adapter $systemAdapter Adapter to the Contao\System class. * @param PurgeCache $purger The cache purger. */ public function __construct( @@ -117,15 +109,13 @@ public function __construct( TranslatorInterface $translator, IFactory $factory, Connection $connection, - Adapter $systemAdapter, PurgeCache $purger ) { - $this->twig = $twig; - $this->translator = $translator; - $this->factory = $factory; - $this->connection = $connection; - $this->systemAdapter = $systemAdapter; - $this->purger = $purger; + $this->twig = $twig; + $this->translator = $translator; + $this->factory = $factory; + $this->connection = $connection; + $this->purger = $purger; } /** @@ -172,16 +162,16 @@ protected function process($table, $metaModelName, $parentId, Request $request) } if ($request->request->has('add') || $request->request->has('saveNclose')) { $this->perform($table, $request, $metaModel, $parentId); - // If we want to close, go back to referer. + // If we want to close, go back to the parent list. if ($request->request->has('saveNclose')) { - return new RedirectResponse($this->getReferer($request, $table, false)); + return new RedirectResponse($this->getReferer($table, $parentId)); } } - return $this->render( - '@MetaModelsCore/Backend/add-all.html.twig', - $this->renderOutput($table, $metaModel, $request) - ); + $output = $this->renderOutput($table, $metaModel, $request); + $output['href'] = $this->getReferer($table, $parentId); + + return $this->render('@MetaModelsCore/Backend/add-all.html.twig', $output); } /** @@ -211,7 +201,6 @@ protected function renderOutput($table, $metaModel, Request $request) 'title' => $headline, 'action' => '', 'requestToken' => $tokenManager->getDefaultTokenValue(), - 'href' => $this->getReferer($request, $table, true), 'backBt' => $this->translator->trans('backBT', [], $table), 'add' => $this->translator->trans('continue', [], $table), 'saveNclose' => $this->translator->trans('saveNclose', [], $table), @@ -404,22 +393,38 @@ private function perform(string $table, Request $request, IMetaModel $metaModel, } /** - * Get the current Backend referrer URL. + * Build the back URL to the parent settings list. * - * @param Request $request The request. - * @param string $table The table name. - * @param bool $encodeAmp Flag to encode ampersands or not. + * Contao 5.7 no longer maintains the session based referer, so the URL is built + * deterministically from the settings table and its parent id. + * + * @param string $table The settings table name. + * @param string $parentId The id of the parent record (input screen / render setting). * * @return string */ - private function getReferer(Request $request, string $table, bool $encodeAmp = false): string + private function getReferer(string $table, string $parentId): string { - $uri = $this->systemAdapter->getReferer($encodeAmp, $table); - // Make the location an absolute URL - if (!preg_match('@^https?://@i', $uri)) { - $uri = $request->getBasePath() . '/' . ltrim($uri, '/'); - } + $router = System::getContainer()->get('router'); + assert($router instanceof UrlGeneratorInterface); - return $uri; + return $router->generate('metamodels.configuration', ['tableName' => $table]) + . '?pid=' . $this->getParentProviderName($table) . '::' . $parentId; + } + + /** + * Get the parent data provider name for the given settings table. + * + * @param string $table The settings table name. + * + * @return string + */ + protected function getParentProviderName(string $table): string + { + return match ($table) { + 'tl_metamodel_dcasetting' => 'tl_metamodel_dca', + 'tl_metamodel_rendersetting' => 'tl_metamodel_rendersettings', + default => $table, + }; } } diff --git a/src/CoreBundle/Controller/Backend/InputScreenAddAllController.php b/src/CoreBundle/Controller/Backend/InputScreenAddAllController.php index d8d5d80c6..d22ae4658 100644 --- a/src/CoreBundle/Controller/Backend/InputScreenAddAllController.php +++ b/src/CoreBundle/Controller/Backend/InputScreenAddAllController.php @@ -21,7 +21,6 @@ namespace MetaModels\CoreBundle\Controller\Backend; -use Contao\CoreBundle\Framework\Adapter; use Doctrine\DBAL\Connection; use MetaModels\Attribute\IAttribute; use MetaModels\Attribute\IInternal; @@ -57,22 +56,20 @@ class InputScreenAddAllController extends AbstractAddAllController /** * Create a new instance. * - * @param TwigEnvironment $twig The templating instance. - * @param TranslatorInterface $translator The translator. - * @param IFactory $factory The MetaModels factory. - * @param Connection $connection The database connection. - * @param Adapter $systemAdapter Adapter to the Contao\System class. - * @param PurgeCache $purger The cache purger. + * @param TwigEnvironment $twig The templating instance. + * @param TranslatorInterface $translator The translator. + * @param IFactory $factory The MetaModels factory. + * @param Connection $connection The database connection. + * @param PurgeCache $purger The cache purger. */ public function __construct( TwigEnvironment $twig, TranslatorInterface $translator, IFactory $factory, Connection $connection, - Adapter $systemAdapter, PurgeCache $purger ) { - parent::__construct($twig, $translator, $factory, $connection, $systemAdapter, $purger); + parent::__construct($twig, $translator, $factory, $connection, $purger); $this->translator = $translator; } diff --git a/src/CoreBundle/Resources/config/services.yml b/src/CoreBundle/Resources/config/services.yml index c407a8a83..89f6770f1 100644 --- a/src/CoreBundle/Resources/config/services.yml +++ b/src/CoreBundle/Resources/config/services.yml @@ -147,7 +147,6 @@ services: - "@contao.translation.translator" - "@metamodels.factory" - "@database_connection" - - "@=service('contao.framework').getAdapter('Contao\\\\System')" - '@metamodels.cache.purger' metamodels.controller.inputscreen.add_all: class: MetaModels\CoreBundle\Controller\Backend\InputScreenAddAllController