Heading of Block is set to its name at creation time.

Posted on

[ContentType(GUID = "93E02D00-1BA4-404E-9D04-BD6433E3AE6E")]
public class TechnicalDetailsBlock : SiteBlockData, ICreatingContentHandler
    public virtual String Heading { get; set; }

    public void CreatingContentHandler(object sender, ContentEventArgs e)
// ReSharper disable SuspiciousTypeConversion.Global
        var technicalDetailsBlock = e.Content as TechnicalDetailsBlock;
// ReSharper restore SuspiciousTypeConversion.Global
        if (technicalDetailsBlock != null)
            technicalDetailsBlock.Heading = e.Content.Name;

Explained doing strange casting

ICreatingContentHandler described

Folders for tree block structure

Posted on Updated on

ContentReference static members

That picture reminds me that there are as well folder for Blocks and I have take advantage of this structure at some point. So far only using page structure for pages.

When its null? ContentArea vs Block

Posted on Updated on

I had mistunderstanding with myself, and I want now to clarify.

Block can never be null according to Joel (link missing).

public virtual MyBlock MyBlock { get; set;}

ContentArea can be null and very often is. (whatever is empty collection or similar, is stored in DB as null)

public virtual ContentAre Pages { get; set;}