Local Block as a part of the ContentArea

545 views Asked by At

Preambula

[ContentType(...)]
public abstract class _BaseSitePage : PageData { ... }

[ContentType(...)]
public abstract class _ContentPage : _BaseSitePage
{
    [Display(Name = "Content 1", GroupName = SystemTabNames.Content, Order = 4)]
    public virtual ContentArea Content1 { get; set; }  
}

public abstract class _FixedBodyLayoutPage : _ContentPage
{
    [Display(Name = "Body", GroupName = SystemTabNames.Content, Order = 100)]
    public virtual ThreeColumnRowBlock Body{ get; set; }
}

During creating the instance of the _FixedBodyLayoutPage I want to place instance of the local block ThreeColumnRowBlock inside the Content1 as a predefined block. Also I want to show on edit pages Only properties of the ThreeColumnRowBlock instance and hide the Content1.

[Editable(false), ScaffoldColumn(false)]
public override ContentArea Content1
{
  get { return this.GetPropertyValue(x => base.Content1); }
  set { this.SetPropertyValue(x => base.Content1, value); }
}

The problem is: I cannot find any suitable way to register instance of the ThreeColumnRowBlock inside the Content1 content area. API requires ContentReference, but from what i see local blocks does not have it.

Partly found solution: instead of local block can be used shared blocks.

But then I loose ability to edit there properties on edit pages without deep navigation. Which i want to avoid a lot. All those nesting is breaking the concept of CMS, be more concentrated on content instead of hierarchy of objects.

Is it possible to somehow bind local block to shared block? or force episerver to display shared block properties inside the page editors?

I also try to implement get/set which extracts instance of the shared block and returns it instead of local block. But that does not trick the episerver. Edit pages displays data from wrong instance.

0

There are 0 answers