Class LinkItem
Class that is used to represent and work with a html link.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.SpecializedProperties
Assembly: EPiServer.dll
Version: 9.12.2Syntax
public class LinkItem : ICloneable
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 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 string Href { get; set; }
Property Value
Type | Description |
---|---|
System.String | The href part of the link. |
Langauge
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 Langauge { get; }
Property Value
Type | Description |
---|---|
System.String | The language. |
Remarks
In case no language is specified LanguageResolver is returned.
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.
Target
Gets or sets the target part of the link.
Declaration
public 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 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 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
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. |
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 string GetMappedHref()
Returns
Type | Description |
---|---|
System.String | A mapped representation of the link. |
GetMappedHref(Boolean)
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. |
ToMappedLink()
Creates an external representation of the link.
Declaration
public string ToMappedLink()
Returns
Type | Description |
---|---|
System.String | An external representation of the link. |
ToMappedLink(Boolean)
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. |
ToPermanentLink()
Creates an internal representation of the link.
Declaration
public string ToPermanentLink()
Returns
Type | Description |
---|---|
System.String | An internal representation of the link. |