Skip to content

Commit

Permalink
Use router to generate backend routes
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Mar 19, 2024
1 parent ee243a7 commit 2ab360b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/MegaMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function headerCallback($headerFields, $dc)
->prepare('SELECT count(*) as count FROM ' . $dc->table . ' WHERE pid = ?')
->execute($dc->currentPid);
if (!$columnsCount->count) {
$this->redirect('contao?do=rocksolid_mega_menu&act=edit&id=' . $dc->currentPid . '&ref=' . Input::get('ref') . '&rt=' . System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue());
$this->redirect(System::getContainer()->get('router')->generate('contao_backend', ['do' => 'rocksolid_mega_menu', 'act' => 'edit', 'id' => $dc->currentPid, 'ref' => Input::get('ref'), 'rt' => System::getContainer()->get('contao.csrf.token_manager')->getDefaultTokenValue()]));
}

}
Expand Down Expand Up @@ -123,7 +123,7 @@ public function getTemplates()
public function dcaOnloadCallback($dc)
{
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create('')) && !static::checkLicense()) {
$this->redirect('contao?do=rocksolid_mega_menu&table=tl_rocksolid_mega_menu_license&ref=' . Input::get('ref'));
$this->redirect(System::getContainer()->get('router')->generate('contao_backend', ['do' => 'rocksolid_mega_menu', 'table' => 'tl_rocksolid_mega_menu_license', 'ref' => Input::get('ref')]));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'closed' => true,
'onsubmit_callback' => array(
function() {
Controller::redirect('contao?do=rocksolid_mega_menu&ref=' . System::getContainer()->get('request_stack')->getCurrentRequest()->get('_contao_referer_id'));
Controller::redirect(System::getContainer()->get('router')->generate('contao_backend', ['do' => 'rocksolid_mega_menu', 'ref' => System::getContainer()->get('request_stack')->getCurrentRequest()->get('_contao_referer_id')]));
},
),
),
Expand Down

0 comments on commit 2ab360b

Please sign in to comment.