November Happy Hour will be moved to Thursday December 5th.

Class ContentArea

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

Inheritance
System.Object
ContentArea
Implements
System.Web.IHtmlString
System.Runtime.Serialization.ISerializable
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
public class ContentArea : XhtmlString, IHtmlString, 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

Gets all content fragments in this area.

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

Contents

Gets all the content within this content area.

Declaration
[Obsolete("Use the Items collection to get the content area contents")]
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

Gets the filtered fragments filtered for access rights and publish status

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

Returns content fragments that the given principal should see.

FilteredContents

Gets the filtered content filtered for access rights and publish status.

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

Returns contents that the given principal should see.

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>

The filtered content area items.

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)

Adds the specified content.

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

The content.

Add(IContent, ISecuredFragmentMarkupGenerator)

Adds a content

Declaration
[Obsolete("Use the Items collection when altering contents of a ContentArea")]
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>)

Adds a content

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

The content.

ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator

The secured fragment markup generator.

System.Collections.Generic.IDictionary<System.String, System.Object> attributes

The custom attributes for the fragment.

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

Insert(Int32, IContent)

Inserts the specified index.

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

The index.

IContent content

The content.

Insert(Int32, IContent, ISecuredFragmentMarkupGenerator)

Inserts a content to a specific position.

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

The index.

IContent content

The content.

ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator

The secured fragment markup generator.

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

Inserts a content to a specific position.

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

The index.

IContent content

The content.

ISecuredFragmentMarkupGenerator securedFragmentMarkupGenerator

The secured fragment markup generator.

System.Collections.Generic.IDictionary<System.String, System.Object> attributes

The custom attributes for the fragment.

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)

Removes a content

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

The content.

Implements

System.Web.IHtmlString
System.Runtime.Serialization.ISerializable

Extension Methods