OrchardCMS / OrchardDoc

Documentation for Orchard 1.x (not Orchard Core, for that see https://docs.orchardcore.net/).
http://docs.orchardproject.net
142 stars 241 forks source link

document the Orchard focused HtmlHelper extension methods #250

Open rtpHarry opened 8 years ago

rtpHarry commented 8 years ago

I was just digging around looking for best practices and I've found about five different ways that Orchard handles creating links like, for example the edit link:

<a href="@Url.Action("Edit", new {commentEntry.Comment.Id})" title="@T("Edit")">@T("Edit")</a>@T(" | ")

@Html.ActionLink(T("Edit").ToString(), "Edit", new {name = tenant.Name, area = "Orchard.MultiTenancy"}) 

@Html.ActionLink(T("Edit").Text, "Edit", "Admin", new { area = "Contents", id = Model.CurrentMenu.Id, returnUrl = Url.Action("Index") }, new { @class = "button" })

@Html.ItemEditLink(T("Edit").Text, contentItem)@T(" | ")

@Html.ItemEditLink(T("Edit").Text, termEntry.ContentItem, new { returnUrl = Url.Action("Index", "TermAdmin", new { taxonomyId = Model.Taxonomy.Id }) }) |

@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, contentItem)

The last two caught my eye as they seem to be the standardised ones built in to the Orchard Framework but they aren't widely known and used.

This page should be written a reference guide rather than a tutorial. Just explain each method in plain language, describe its parameters and give a usage example.