-
Notifications
You must be signed in to change notification settings - Fork 18
Implemented base path support in the UrlHelper #6
Implemented base path support in the UrlHelper #6
Conversation
This feature will allow prefixing the generated path with a detected and/or calculated base path, ensuring: - Routes do not need to accommodate the prefix. - All generated URIs will have the prefix.
Ping @RalfEggert — the need to prefix all routes with the detected locale has been bothering me, and I thought this might be a nice solution. The one drawback is that we will likely want to add base path support to the zend-view |
Looks like I could use that for my base URL middleware as well. Nice! |
Looks fine. I just wonder how to add the base bath within an action middleware that needs to redirect and return a
To access the language I can only access the |
Well, I can answer the question myself. Your suggested Should I I update this recipe? I could remove the https://github.com/zendframework/zend-expressive/pull/244/files |
@RalfEggert — no request attribute is necessary. In fact, what you can do is compose the return new RedirectResponse(
$this->helper->generate('pizza-show', $routeParams)
); and, with the change this patch introduces, assuming the locale has been injected as the base path previously, it will be included in the generated URI. As to the question of updating the localization recipe you've written: yes, once I've merged this patch and tagged a new release, let's do that. |
This feature will allow prefixing the generated path with a detected and/or calculated base path, ensuring: