From de28a07da2afb168038ce95c5279977f16b492d3 Mon Sep 17 00:00:00 2001 From: rldhont Date: Mon, 4 Dec 2023 16:58:15 +0100 Subject: [PATCH] Extendable map parameters for redirection after authentication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Funded by [SDEC énergie](https://www.sdec-energie.fr/) --- .../modules/view/controllers/map.classic.php | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lizmap/modules/view/controllers/map.classic.php b/lizmap/modules/view/controllers/map.classic.php index 279f566f01..ea8e5e7ab2 100644 --- a/lizmap/modules/view/controllers/map.classic.php +++ b/lizmap/modules/view/controllers/map.classic.php @@ -30,23 +30,22 @@ public function index() 'project' => $project, ); // other map params - if ($this->param('layers')) { - $url_params['layers'] = $this->param('layers'); - } - if ($this->param('bbox')) { - $url_params['bbox'] = $this->param('bbox'); - } - if ($this->param('crs')) { - $url_params['crs'] = $this->param('crs'); - } - if ($this->param('filter')) { - $url_params['filter'] = $this->param('filter'); - } - if ($this->param('layerStyles')) { - $url_params['layerStyles'] = $this->param('layerStyles'); - } - if ($this->param('layerOpacities')) { - $url_params['layerOpacities'] = $this->param('layerOpacities'); + $knownKeyParams = array( + 'layers', + 'bbox', + 'crs', + 'filter', + 'layerStyles', + 'layerOpacities', + ); + // Get redirection parameters + $redirectKeyParams = jEvent::notify('getRedirectKeyParams', array('repository' => $repository, 'project' => $project))->getResponse(); + $keyParams = array_unique(array_merge($knownKeyParams, $redirectKeyParams), SORT_REGULAR); + $params = $this->params(); + foreach ($keyParams as $key) { + if (array_key_exists($key, $params)) { + $url_params[$key] = $params[$key]; + } } if ($rep->getType() === 'html') {