Context aware "Infinite Editing" (Block List), how to get a reference to the page doctype in SendingContentModel event?
Hi all,
I have a composition that contains a Block List Editor property, this composition is used on two document types. For example:
Doctype1
BlockListProp (from composition)
blockDocType1
blockDocType2
...
Doctype2
BlockListProp (from composition)
blockDocType1
blockDocType2
...
Now I want to hook into the SendingContentModel, and set properties as read-only for blockDocType1 that sits as part of Doctype1, but crucially they should not be made read-only for Doctype2.
So when I click to edit the block, the editor pane opens and code below is fired:
Psuedo(ish) code:
EditorModelEventManager.SendingContentModel += SetReadOnlyProperties;
private void SetReadOnlyProperties(HttpActionExecutedContext sender, EditorModelEventArgs<ContentItemDisplay> editor)
{
if (editor.Model.ContentTypeAlias == blockDocType1.Alias)
{
//AND IF base page is Doctype1 <---- IMPORTANT BIT
// then do some readonly stuff
// eg:
foreach (var variant in editor.Model.Variants)
{
foreach (var tab in variant.Tabs)
{
foreach (var prop in tab.Properties)
{
prop.Readonly = true;
}
}
}
}
}
So somehow I need to have the context of the page DocType inside this event. Is this even possible with infinite editing? If so how would I retrieve it?
Context aware "Infinite Editing" (Block List), how to get a reference to the page doctype in SendingContentModel event?
Hi all,
I have a composition that contains a Block List Editor property, this composition is used on two document types. For example:
Doctype1
Doctype2
Now I want to hook into the SendingContentModel, and set properties as read-only for blockDocType1 that sits as part of Doctype1, but crucially they should not be made read-only for Doctype2.
So when I click to edit the block, the editor pane opens and code below is fired:
Psuedo(ish) code:
So somehow I need to have the context of the page DocType inside this event. Is this even possible with infinite editing? If so how would I retrieve it?
Thanks in advance!
Hello Matt,
Did you find a solution for this?
is working on a reply...