Links to Detail page does not work when using folder-URLs
Closed this issue · 1 comments
Bug description
When using folder-urls in Contao, the links to the detail pages in the immobilien overview is set incorrectly.
If you have the list on the page:
/kaufen/
and the detail list on the page:
/kaufen/immobilie/
the auto_item expose should be added:
/kaufen/immobilie/expose/my-object-with-id-123/
Instead, the following link is set:
/kaufen/exposeimmobilie/expose/my-object-with-id-123/
The error is in file
vendor/pdir/maklermodul-bundle/src/Module/ListView.php:154
The code
return str_replace($urlSuffix, '/'.DetailView::PARAMETER_KEY, $baseUri);
replaces every occurance of the $urlSuffix
(here: /
) and appends the auto_item "expose".
Instead, we only want the last occurance to be replaced:
return preg_replace('%'.preg_quote($urlSuffix).'$%', '/' . DetailView::PARAMETER_KEY, $baseUri);
Environment
Contao 4.4, PHP 7.3, MaklerModul 2.1.4
fixed in new version