Skip to content

Commit

Permalink
Adding an option for forcing the alternate tag in the BeginLinks in t…
Browse files Browse the repository at this point in the history
…he XE, as there are issues with displaying components with these taks in 9.1 in the XE when the component only has a section tag surrounding it.
  • Loading branch information
royhyde-dd committed Mar 27, 2019
1 parent 9768f27 commit a38f4e6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/DeloitteDigital.Atlas/Mvc/HtmlExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ public static MvcEditFrame BeginEditFrame<T>(this HtmlHelper<T> helper, string d
return frame;
}

public static IDisposable BeginLink(this HtmlHelper htmlHelper, ILinkFieldRenderingString linkField, string alternateTag = null, bool skipInPageEditor = false, string linkTagClass = null)
public static IDisposable BeginLink(this HtmlHelper htmlHelper, ILinkFieldRenderingString linkField, string alternateTag = null, bool skipInPageEditor = false, bool alternateTagInPageEditor = false, string linkTagClass = null)
{
if (skipInPageEditor && global::Sitecore.Context.PageMode.IsExperienceEditor)
return new EmptyMvcLink();
if (alternateTagInPageEditor && global::Sitecore.Context.PageMode.IsExperienceEditor)
return new MvcLink(htmlHelper.ViewContext, null, alternateTag, linkTagClass);
return new MvcLink(htmlHelper.ViewContext, linkField, alternateTag, linkTagClass);
}
}
Expand Down

2 comments on commit a38f4e6

@hollywoodinvegas
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need a new field for this? I'm not sure of the actual defect could the extra condition be
if (!string.IsNullOrWhiteSpace(alternateTag)) && global::Sitecore.Context.PageMode.IsExperienceEditor)

@royhyde-dd
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hollywoodinvegas That's a very good point. However, that would create the issue where it will assume that you will always want to use the alternate tag in XE if you have provided one, which may not always be the case.

Please sign in to comment.