Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Class ContentArea

Represents an structure that controls how Content are placed in an area.

Inheritance
System.Object
ContentArea
Implements
System.Runtime.Serialization.ISerializable
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public class ContentArea : XhtmlString, ISerializable, IReadOnly<XhtmlString>, IReadOnly<ContentArea>, IReadOnly, IReferenceMap
Remarks

This class is a container of string fragments each representing where a content is placed in the area.

Constructors

ContentArea()

Initializes a new empty instance of the ContentArea class.

Declaration
public ContentArea()

ContentArea(String)

Initializes a new instance of the ContentArea class with the passed value.

Declaration
public ContentArea(string unparsedString)
Parameters
Type Name Description
System.String unparsedString

The value that should be assigned to the new instace.

Properties

ContentFragments

Declaration
[Obsolete("Use the Items collection to get the content area contents", true)]
public virtual IEnumerable<ContentFragment> ContentFragments { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ContentFragment>

Contents

Declaration
[Obsolete("Use the Items collection to get the content area contents", true)]
public virtual IEnumerable<IContent> Contents { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IContent>

Count

Returns the number of content fragments found

Declaration
public virtual int Count { get; }
Property Value
Type Description
System.Int32

FilteredContentFragments

Declaration
[Obsolete("Use the Items collection to get the content area contents", true)]
public virtual IEnumerable<ContentFragment> FilteredContentFragments { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ContentFragment>

FilteredContents

Declaration
[Obsolete("Use the Items collection to get the content area contents", true)]
public virtual IEnumerable<IContent> FilteredContents { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IContent>

FilteredItems

Gets the ContentAreaItems filtered by publish status, permissions and personalization.

Declaration
public virtual IEnumerable<ContentAreaItem> FilteredItems { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ContentAreaItem>

FragmentFactory

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets or sets the content fragment factory.

Declaration
public Injected<ContentFragmentFactory> FragmentFactory { get; set; }
Property Value
Type Description
Injected<ContentFragmentFactory>

Items

Gets the items hosted by this ContentArea.

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

MarkupGeneratorFactory

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets or sets the content fragment factory.

Declaration
public Injected<ISecuredFragmentMarkupGeneratorFactory> MarkupGeneratorFactory { get; set; }
Property Value
Type Description
Injected<ISecuredFragmentMarkupGeneratorFactory>

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.

Tag

Gets or sets the tag for the Content Area.

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

Methods

Add(IContent)

Declaration
[Obsolete("Use the Items collection when altering contents of a ContentArea", true)]
public void Add(IContent content)
Parameters
Type Name Description
IContent content

Add(IContent, ISecuredFragmentMarkupGenerator)

Adds a content

Declaration
[Obsolete("Use the Items collection when altering contents of a ContentArea", true)]
public void Add(IContent content, ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator)
Parameters
Type Name Description
IContent content

The content.

ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator

The secured fragment markup generator.

Add(IContent, ISecuredFragmentMarkupGenerator, IDictionary<String, Object>)

Declaration
[Obsolete("Use the Items collection when altering contents of a ContentArea", true)]
public void Add(IContent content, ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator, IDictionary<string, object> attributes)
Parameters
Type Name Description
IContent content
ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator
System.Collections.Generic.IDictionary<System.String, System.Object> attributes

Copy()

Creates a deep copy of this instance.

Declaration
public ContentArea Copy()
Returns
Type Description
ContentArea

A copy of the current instance.

CreateStringFragments(String)

Creates a collection containing string fragments from the unparsed string.

Declaration
protected override StringFragmentCollection CreateStringFragments(string unparsedString)
Parameters
Type Name Description
System.String unparsedString

The unparsed XHTML string.

Returns
Type Description
StringFragmentCollection

A new StringFragmentCollection containing fragments from the provided string.

Overrides

CreateWritableClone()

Creates the writable clone.

Declaration
public ContentArea CreateWritableClone()
Returns
Type Description
ContentArea

CreateWriteableCloneImplementation()

Creates a writable deep clone of the current object.

Declaration
protected override XhtmlString CreateWriteableCloneImplementation()
Returns
Type Description
XhtmlString

A writable copy of the current instance.

Overrides

Filter(IPrincipal)

Gets the ContentAreaItems filtered by publish status, permissions and personalization.

Declaration
public virtual IEnumerable<ContentAreaItem> Filter(IPrincipal principal)
Parameters
Type Name Description
System.Security.Principal.IPrincipal principal

The principal for which the items are filtered

Returns
Type Description
System.Collections.Generic.IEnumerable<ContentAreaItem>

The filtered content area items.

Insert(Int32, IContent)

Declaration
[Obsolete("Use the Items collection when altering contents of a ContentArea", true)]
public void Insert(int index, IContent content)
Parameters
Type Name Description
System.Int32 index
IContent content

Insert(Int32, IContent, ISecuredFragmentMarkupGenerator)

Declaration
[Obsolete("Use the Items collection when altering contents of a ContentArea", true)]
public void Insert(int index, IContent content, ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator)
Parameters
Type Name Description
System.Int32 index
IContent content
ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator

Insert(Int32, IContent, ISecuredFragmentMarkupGenerator, IDictionary<String, Object>)

Declaration
[Obsolete("Use the Items collection when altering contents of a ContentArea", true)]
public void Insert(int index, IContent content, ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator, IDictionary<string, object> attributes)
Parameters
Type Name Description
System.Int32 index
IContent content
ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator
System.Collections.Generic.IDictionary<System.String, System.Object> attributes

MakeReadOnly()

Makes this instance read only.

Declaration
public override void MakeReadOnly()
Overrides
Remarks

It will also make its Fragments and ContentAreaItems readonly.

Move(Int32, Int32)

Moves a content from one position to another.

Declaration
public void Move(int oldIndex, int newIndex)
Parameters
Type Name Description
System.Int32 oldIndex

The old index. Start index is 0.

System.Int32 newIndex

The new index. Start index is 0.

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.

Remove(IContent)

Declaration
[Obsolete("Use the Items collection when altering contents of a ContentArea", true)]
public void Remove(IContent content)
Parameters
Type Name Description
IContent content

Implements

System.Runtime.Serialization.ISerializable

Extension Methods