Posted on 06/01/2021 15:51:15
Hi Nuno
customMasterBlocksPage.GetBlocksStructure() returns this:
- Root SortId: 10
- Head SortId: 10
- HeadMetadata SortId: 10
- HeadCss SortId: 20
- HeadManifest SortId: 30
- Body SortId: 20
- Master SortId: 10
- MasterTopSnippets SortId: 10
- FacebookPixel SortId: 2
- LoginModal SortId: 10
- MasterMain SortId: 20
- MasterHeader SortId: 10
- MasterDesktopTools SortId: 10
- MasterDesktopToolsText SortId: 10
- MasterDesktopToolsNavigation SortId: 20
- MasterDesktopExtra SortId: 10
- MasterDesktopLogo SortId: 10
- MasterSearchBar SortId: 20
- MasterDesktopActionsMenu SortId: 30
- MasterDesktopActionsMenuSignIn SortId: 20
- MasterDesktopActionsMenuLanguageSelector SortId: 40
- MasterDesktopActionsMenuOrderDraft SortId: 40
- MasterDesktopActionsMenuMiniCart SortId: 60
- MiniCartTrigger SortId: 0
- MiniCartLayout SortId: 0
- MasterDesktopNavigation SortId: 20
- MasterDesktopMenu SortId: 10
- MasterPageContent SortId: 20
- MasterFooter SortId: 30
- MasterFooterContent SortId: 10
- MasterFooterColumnOne SortId: 10
- MasterFooterColumnTwo SortId: 20
- MasterFooterSocialLinks SortId: 50
- MasterFooterPayments SortId: 60
- MasterFooterCopyright SortId: 70
- MasterReferences SortId: 40
- MiniCartPageId SortId: 0
- MasterScriptReferences SortId: 1
- MasterJavascriptInitializers SortId: 100
- MasterBottomSnippets SortId: 50
- AddToCartNotificationScript SortId: 0
- OrderlinesScriptTemplates SortId: 0
- MiniCartCounterScriptTemplate SortId: 0
- MasterSearchScriptTemplates SortId: 1
- MasterMiniCartTemplates SortId: 1
- MiniCartOrderLines SortId: 0
- MiniCartOrderLinesList SortId: 20
- MiniCartFooter SortId: 50
- MiniCartSubTotal SortId: 30
- MiniCartFees SortId: 40
- MiniCartPoints SortId: 50
- MiniCartTotal SortId: 60
- MiniCartDisclaimer SortId: 70
- MiniCartActions SortId: 80
When looping the list returned by:
customMasterBlocksPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList()
I get these two id'es: "MasterHeader" and "MasterContentPage" as expected. So I don't think it's a typo.
I have also tried on a clean new Rapido where I inserted the code below into Designs\Rapido\MasterBlocks\Custom__Blocks.cshtml:
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
@using System
@using System.Web
@using System.Collections.Generic
@using Dynamicweb.Rapido.Blocks
@{
BlocksPage customMasterBlocksPage = BlocksPage.GetBlockPage("Master");
var newMasterMainBlock = new Block
{
Id = "MasterMain",
Template = CustomRenderMasterMain(customMasterBlocksPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList())
};
customMasterBlocksPage.ReplaceBlock(newMasterMainBlock);
}
@helper CustomRenderMasterMain(List<Block> subBlocks)
{
<main class="myCustomClass site dw-mod">
@RenderBlockList(subBlocks)
</main>
}
And I get the exact same error.