SaaS CMS has officially launched! Learn more now.

Class LinkItem

Class that is used to represent and work with a html link.

Inheritance
System.Object
LinkItem
Implements
System.ICloneable
System.IEquatable<LinkItem>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.SpecializedProperties
Assembly: EPiServer.dll
Version: 10.10.4
Syntax
public class LinkItem : ICloneable, IEquatable<LinkItem>, IReferenceMap

Constructors

LinkItem()

Initializes a new instance of the LinkItem class.

Declaration
public LinkItem()

LinkItem(XmlNode)

Initializes a new instance of the LinkItem class.

Declaration
public LinkItem(XmlNode anchorNode)
Parameters
Type Name Description
System.Xml.XmlNode anchorNode

An xml node that represents an anchor.

Properties

Attributes

Gets the link attributes.

Declaration
public virtual Dictionary<string, string> Attributes { get; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.String, System.String>

The link attributes.

Href

Gets or sets the href part of the link.

Declaration
public virtual string Href { get; set; }
Property Value
Type Description
System.String

The href part of the link.

Language

Gets the language from the link item.

Declaration
[Obsolete("Use 'new UrlBuilder(linkItem.Href).QueryLanguage' to parse language query from a link item")]
public string Language { get; }
Property Value
Type Description
System.String

The language.

Remarks

In case no language is specified LanguageResolver is returned.

LinkResolver

Gets or sets the service used to resolve links.

Declaration
public Injected<IUrlResolver> LinkResolver { get; set; }
Property Value
Type Description
Injected<IUrlResolver>

ReferencedPermanentLinkIds

Gets an System.Collections.Generic.IList<T> of permanent link ids that are referenced from this property.

Declaration
public virtual IList<Guid> ReferencedPermanentLinkIds { get; }
Property Value
Type Description
System.Collections.Generic.IList<System.Guid>

An System.Collections.Generic.IList<T> of permanent link ids that are referenced from this property.

Target

Gets or sets the target part of the link.

Declaration
public virtual string Target { get; set; }
Property Value
Type Description
System.String

The target part of the link.

Text

Gets or sets the text part of the link.

Declaration
public virtual string Text { get; set; }
Property Value
Type Description
System.String

The text part of the link.

Title

Gets or sets the title part of the link.

Declaration
public virtual string Title { get; set; }
Property Value
Type Description
System.String

The title part of the link.

UrlResolver

Gets or sets the service used to resolve links.

Declaration
[Obsolete("Use LinkResolver instead")]
public Injected<UrlResolver> UrlResolver { get; set; }
Property Value
Type Description
Injected<UrlResolver>

Methods

Clone()

Creates a new object that is a copy of the current instance.

Declaration
public object Clone()
Returns
Type Description
System.Object

A new object that is a copy of this instance.

Equals(LinkItem)

Declaration
public bool Equals(LinkItem other)
Parameters
Type Name Description
LinkItem other
Returns
Type Description
System.Boolean

GetMappedHref()

Tries to get a mapped representation (that is a link with an absolute path) of the Href property; otherwise returns the Href.

Declaration
public virtual string GetMappedHref()
Returns
Type Description
System.String

A mapped representation of the link.

GetMappedHref(Boolean)

Tries to get a mapped representation of the Href property; otherwise returns the Href.

Declaration
[Obsolete("Use the overload of GetMappedHref without any parameters.", false)]
public string GetMappedHref(bool addPreferredLanguageIfEmpty)
Parameters
Type Name Description
System.Boolean addPreferredLanguageIfEmpty

If the preferred language should be added when no specific language code is present.

Returns
Type Description
System.String

A mapped representation of the link.

RemapPermanentLinkReferences(IDictionary<Guid, Guid>)

Remaps permanent links according to the provided link mapping.

Declaration
public virtual void RemapPermanentLinkReferences(IDictionary<Guid, Guid> idMap)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<System.Guid, System.Guid> idMap

The link mapping.

Creates an external representation of the link.

Declaration
public virtual string ToMappedLink()
Returns
Type Description
System.String

An external representation of the link.

Creates an external representation of the link.

Declaration
[Obsolete("Use the overload of ToMappedLink without any parameters.", false)]
public string ToMappedLink(bool addPreferredLanguageIfEmpty)
Parameters
Type Name Description
System.Boolean addPreferredLanguageIfEmpty

If the preferred language should be added when no specific language code is present.

Returns
Type Description
System.String

An external representation of the link.

Creates an internal representation of the link.

Declaration
public virtual string ToPermanentLink()
Returns
Type Description
System.String

An internal representation of the link.

Implements

System.ICloneable
System.IEquatable<T>

Extension Methods