Class PropertyXhtmlString
A property representing a static or dynamic xhtml string value. This property has support to handle dynamic fragments like dynamic content, personalized content and permanent links.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.SpecializedProperties
Assembly: EPiServer.dll
Version: 9.12.2Syntax
[PropertyDefinitionTypePlugIn]
public class PropertyXhtmlString : PropertyLongString, IReadOnly<PropertyData>, IReadOnly, ILazyProperty, IReferenceMap, IPropertyPreferLoadData, IPersonalizedRoles, IDeserializationCallback
Constructors
PropertyXhtmlString()
Initializes a new instance of the PropertyXhtmlString class.
Declaration
public PropertyXhtmlString()
PropertyXhtmlString(String)
Initializes a new instance of the PropertyXhtmlString class.
Declaration
public PropertyXhtmlString(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
PropertyXhtmlString(String, IPrincipalAccessor)
Exposed for unit tests
Declaration
public PropertyXhtmlString(string value, IPrincipalAccessor principalAccessor)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | |
IPrincipalAccessor | principalAccessor |
Properties
FragmentParser
Gets or sets the current fragment parser used to parse the string to fragments.
Declaration
[Obsolete("Access FragmentParser through the XhtmlString.FragmentParser property")]
public IFragmentParser FragmentParser { get; set; }
Property Value
Type | Description |
---|---|
IFragmentParser |
Fragments
Exposes the different fragments in the underlying xhtml string. Can be used by rendering control to put fragments in rendered pages control collection
Declaration
[Obsolete("Access fragments through the XhtmlString.Fragments property")]
public StringFragmentCollection Fragments { get; protected set; }
Property Value
Type | Description |
---|---|
StringFragmentCollection | The string fragments. |
IsModified
Declaration
public override bool IsModified { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsNull
Check for null property (no value has been set).
Declaration
public override bool IsNull { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Overrides
LongString
Gets or sets the string representation with normal links. This is how actual content is accessed. The setter will parse the content, and insert permanent links where appropriate. The getter will, if necessary, reparse the content to split it into the mixed list representation to speed up dynamic rendering of links.
Declaration
protected override string LongString { get; set; }
Property Value
Type | Description |
---|---|
System.String | The long string. |
Overrides
PropertyValueType
Gets the System.Type for this property.
Declaration
public override Type PropertyValueType { get; }
Property Value
Type | Description |
---|---|
System.Type | The System.Type of the property value. |
Overrides
ReferencedPermanentLinkIds
Gets an System.Collections.Generic.IList<T> of permanent link ids that are referenced from this property.
Declaration
public 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. |
Value
The value of the property.
Declaration
public override object Value { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The value of the property. |
Overrides
Remarks
Value returns null if the property has no value defined.
NOTE: The type of the returned value is different when running in compatibility mode according to the LegacyPropertyValueType flag of OperationCompatibility
XhtmlString
Gets or sets the XHTML string.
Declaration
public XhtmlString XhtmlString { get; set; }
Property Value
Type | Description |
---|---|
XhtmlString | The XHTML string. |
Methods
Copy()
Creates a copy of this object.
Declaration
public override PropertyData Copy()
Returns
Type | Description |
---|---|
PropertyData | A new PropertyData object. |
Overrides
CreatePropertyControl()
Creates an PropertyXhtmlStringControl that is used to display a user interface for the property.
Declaration
public override IPropertyControl CreatePropertyControl()
Returns
Type | Description |
---|---|
IPropertyControl | An PropertyXhtmlStringControl that is used to display a user interface for the property. |
Overrides
Remarks
It is possible to change which control should be used by registering a different IPropertyControl for the PropertyData class in PropertyControlClassFactory.
CreateWritableClone()
Creates a writable clone of the property.
Declaration
public override PropertyData CreateWritableClone()
Returns
Type | Description |
---|---|
PropertyData | A writable copy of the property. |
Overrides
GetRoles()
Gets all used personalized content roles from it's fragments
Declaration
public virtual IEnumerable<string> GetRoles()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The names of all virtual roles that have personalized content in the property content. |
LoadData(Object)
Sets the internal representation from what is stored in the database. "Deserialize".
Declaration
public override void LoadData(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The internal value. |
Overrides
MakeReadOnly()
Override to avoid the base class referring to our Value property to avoid dead-lock when this happens indirectly via DataFactory.
Declaration
public override void MakeReadOnly()
Overrides
Parse(String)
Returns a new PropertyXhtmlString based on the string value.
Declaration
public static PropertyXhtmlString Parse(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Returns
Type | Description |
---|---|
PropertyXhtmlString |
ParseToObject(String)
Returns a new PropertyXhtmlString based on the string value.
Declaration
public override PropertyData ParseToObject(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Returns
Type | Description |
---|---|
PropertyData |
Overrides
ParseToSelf(String)
Sets the LongString to the value.
Declaration
public override void ParseToSelf(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Overrides
ParseToXhtmlString(String)
Parse a string to Xhtml. This function is used internally by the class to convert values to Xhtml. If you write your own class and inherit this class, you can modify the parser logic by overriding this function.
Declaration
public virtual string ParseToXhtmlString(string unparsedString)
Parameters
Type | Name | Description |
---|---|---|
System.String | unparsedString | A string containing html that will be converted to Xhtml, if possible. |
Returns
Type | Description |
---|---|
System.String | A string with the value converted to Xhtml. |
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. |
SaveData(PropertyDataCollection)
Get the data representation suitable for storing to the database. "Serialize".
Declaration
public override object SaveData(PropertyDataCollection properties)
Parameters
Type | Name | Description |
---|---|---|
PropertyDataCollection | properties | The properties for the current page. |
Returns
Type | Description |
---|---|
System.Object | A string representation of the xhtml where the permanent links have not been resolved. |
Overrides
Remarks
Returns with unresolved links
SetDefaultValue()
Sets the default value for this property.
Declaration
protected override void SetDefaultValue()
Overrides
ToWebString()
The Xhtml string representation for view mode.
Declaration
public override string ToWebString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Explicit Interface Implementations
IDeserializationCallback.OnDeserialization(Object)
Runs when the entire object graph has been deserialized.
Declaration
void IDeserializationCallback.OnDeserialization(object sender)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The object that initiated the callback. The functionality for this parameter is not currently implemented. |