flaithbheartaigh / dynamic-delivery-4-tridion

Automatically exported from code.google.com/p/dynamic-delivery-4-tridion
Other
0 stars 0 forks source link

Integrate component link resolution into mvc routing #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
From ASP.Net MVC perspective it would be logical to be able to obtain 
component's page link via construct like this:

    @Html.ActionLink(
        "click me",
        "Component",
        new { componentId = Model.Component.ID }
    )

Instead, at present the only way (?) to obtain a link to a component's page is 
to use DD4T-specific LinkFactory class:

    new LinkFactory
    {
        LinkProvider = new DD4T.Providers.SDLTridion2011sp1.TridionLinkProvider()
    }.ResolveLink(componentId);

(Quick investigation revealed that the problem is that in order to resolve a 
link to page controller action the page's tcm:uri is needed. But instead when 
using standard Tridion component link resolver, it directly returns an opaque 
url, from which it's hardly possible to extract page information.)

Original issue reported on code.google.com by estee...@gmail.com on 21 Mar 2012 at 9:04

GoogleCodeExporter commented 8 years ago
Action links return a URL which matches a certain action, but all URLs in DD4T 
are mapped to the same action. The URL is dictated by Tridion rather than the 
MVC application.

Links can be created from the Razor template through the 
GetResolvedLink/GetResolvedUrl methods in the TridionHelper class.

Original comment by quirijn....@gmail.com on 2 Apr 2014 at 6:43