Hi @Juraj,
As your suggest idea, I have solved my issue by prevent the page.Update() by unnecessary. But now I have a new issues after that.
In the event DocumentEvents.Insert.After, I tried to initialized all necessary widgets for page by loading JSON string object to DocumentPageBuilderWidgets of DocumentCultureDataInfo as this article. Example:
protected override void OnInit()
{
base.OnInit();
DocumentEvents.Insert.After += PreLoadWidget;
}
private void PreLoadWidget(object sender, DocumentEventArgs e)
{
var docCultureInfo = DocumentCultureDataInfoProvider.GetDocumentCultureInfo(e.Node.DocumentID);
var widgetsJson = docCultureInfo.DocumentPageBuilderWidgets;
//Create widget json
if (widgetsJson == null || widgetsJson == String.Empty)
{
docCultureInfo.DocumentPageBuilderWidgets = "{\"editableAreas\":" +
"[{\"identifier\":\"areaWithSection\",\"sections\":[{\"identifier\":\"a5738704-5c6f-40e6-b335-61d376ea4da2\"," +
"\"type\":\"NTUCIncome.Sections.Col5050\",\"properties\":null,\"zones\":[{\"identifier\":" +
"\"d49bdbca-44fd-4e2b-8980-01f0333b5511\",\"widgets\":[{\"identifier\":\"68ec1058-ff21-41ee-8d73-e837b91788de\"," +
"\"type\":\"BlogMenuBarWidget\",\"variants\":[{\"identifier\":\"77185730-4901-4ba9-a651-cfbb71a92542\"," +
"\"properties\":null}]}]}]}]},{\"identifier\":\"areaWithSection1\",\"sections\":[{\"identifier\":" +
"\"37657cab-0eb1-4e52-a2bb-d2e6ccefb1e9\",\"type\":\"NTUCIncome.Sections.Col5050\",\"properties\":null," +
"\"zones\":[{\"identifier\":\"82135da4-bb59-41ef-a1cc-1b4859ead49c\"," +
"\"widgets\":[{\"identifier\":\"ef290d65-cd04-4033-a123-10119a4ce66b\"," +
"\"type\":\"BlogArticleWidget\",\"variants\":[{\"identifier\":\"8fdfe6f5-2209-4db7-bafc-d9b450bd2360\"," +
"\"properties\":{\"subTitle\":\"\"}}]}]}]}]},{\"identifier\":\"areaWithSection2\",\"sections\":[{\"identifier\":" +
"\"9c226759-a74f-4fc4-9b54-2ac072d30950\",\"type\":\"NTUCIncome.Sections.Col5050\",\"properties\":null,\"zones\":" +
"[{\"identifier\":\"fe30c82a-60ce-427f-9ba5-9d75ef09a2b5\",\"widgets\":[{\"identifier\":\"4664d403-3983-439a-aa63-0b6b20c8ce70\"," +
"\"type\":\"BottomTagsWidget\",\"variants\":[{\"identifier\":\"7a588bae-5aff-499d-b5e7-61f4af7c8de6\",\"properties\":{}}]}," +
"{\"identifier\":\"5d35cea1-4f20-4333-b799-230c19f4599b\",\"type\":\"AuthorRelatedListWidget\",\"variants\":[{\"identifier\":\"af1c6d93-a77a-4938-8577-1690458fe11b\"," +
"\"properties\":null}]},{\"identifier\":\"eb27c8ef-9a3b-4bf1-898d-271227c2f7bc\",\"type\":\"RelatedProductsWidget\"," +
"\"variants\":[{\"identifier\":\"3aa67328-a85c-4ff1-90c0-f17bc3da6aa8\",\"properties\":null}]}]}]}]},{\"identifier\":\"areaWithSection3\"," +
"\"sections\":[{\"identifier\":\"4ce67bd7-120f-450b-8d08-768da96a29cb\",\"type\":\"NTUCIncome.Sections.Col5050\",\"properties\":null," +
"\"zones\":[{\"identifier\":\"039921c8-276a-4ce6-bba3-b8484d5dcc57\",\"widgets\":[{\"identifier\":\"0f79806c-3897-4392-8fed-4a7ce4562340\"," +
"\"type\":\"RelatedArticlesWidget\",\"variants\":[{\"identifier\":\"ee852be2-49f6-4fcf-99a8-ab1f730425e3\",\"properties\":null}]}]}]}]}]}";
docCultureInfo.Update();
}
}
But the widgets are not load correctly when creating new Blog with content locking.
There is some points from my investigate:
- This issue only occurs when using content locking Check-in/ Check-out
- With enable Check-in/ Check-out, the page cannot initialize all widgets when creating new Blog. → not OK
- With disable Check-in/ Check-out, all widgets are initialized when creating new Blog. → OK
Is my implementation missing anything? Could you please provide any correction?
Thanks