U4-2581 - Make UmbracoContext.UrlProvider public.

Created by Stephan 02 Aug 2013, 08:56:26 Updated by Stephan 10 Oct 2014, 09:36:08

Relates to: U4-4879

Relates to: U4-5627

At the moment UmbracoContext.UrlProvider is internal so it can't be accessed by user code. In views, controllers, etc. there's the UmbracoHelper which gives access to the NiceUrl() methods, but outside of these one needs to create an UmbracoHelper just to get the url of a node. Would be easier to do UmbracoContext.Current.UrlProvider.GetUrl(id).

Or would this clutter the UmbracoContext? Or maybe it's simpler to tell people to just instanciate an UmbracoHelper, so the same syntax is used everywhere?

See: http://our.umbraco.org/forum/developers/api-questions/43722-Getting-NiceUrl-outside-controllerview-context

Comments

Stephan 02 Aug 2013, 09:00:45

In addition:

  • having access to the UrlProvider is already possible via UmbracoContext.Current.PublishedContentRequest.RoutingContext.UrlProvider which I find quite convoluted. Should simplify this.
  • having access to the UrlProvider is important because that's how you can change its mode for the current request so it returns absolute / relative / automatic urls.


Shannon Deminick 09 Oct 2014, 22:50:10

@zpqrtbnk what is the status of this? I'm assigning to 7.2 since I'm assuming this is pretty straightforward?


Stephan 10 Oct 2014, 09:30:59

Should have been done long ago. Taking care of it.


Stephan 10 Oct 2014, 09:36:03

Done


Priority: Normal

Type: Feature (request)

State: Fixed

Assignee: Stephan

Difficulty: Normal

Category: Architecture

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.2.0

Sprint:

Story Points:

Cycle: