Closed fritzmg closed 2 years ago
I think if there is a way to remove the dependency on cca/url-builder, that's also great. However, this solution looks appropriate.
May be this can be removed in general?
Your example in the README uses a POST
request anyway to set the ajax_reload_element
parameter. So it would not be present as a GET
parameter in the first place. And I am not sure why it would need to be removed from the request in general, shouldn't really matter in the end?
There is an error if you try to load an element or module on the start page (
index
). In this caseEnvironment::get('request')
will return an empty string or something likein case of a newslist pagination for example. Running that through the
ContaoCommunityAlliance\UrlBuilder\UrlBuilder
will then however give you the following URL:This is of course wrong - and this wrong request URL will then be set in the
Environment
- which will break any URLs generated by Contao. To work around this bug, this PR simply prepends therequest
URL with a slash - and then removes it again, since theEnvironment
class assumes it to be without the leading slash (contrary to Symfony'sRequest
).See also https://github.com/contao-community-alliance/url-builder/issues/3