Hi,
I have a question regarding nested blocks and how to define the type of blocks that are allowed to be nested.
Assume that we have a situation like the one shown in one of the Litium guides (Blocks) where the footer column block has the footer links block nested. How can I set this up in code so that it’s only possible to have the footer links block type nested in the footer column block?
I’ve tried to set the TypeSelections
in the field template setup for the parent block. In order to get the id of the block that is going to be nested I’ve used the FieldTemplateService
but this process assumes that the block that is going to be nested (footer links) already exists. Although this might not be the case if both blocks are created at the same time, for example when the application starts for the first time and all the field templates are being created.
I’ve tried to remove and create the templates a couple of times and it has happened that the template for the block that is supposed to be nested is being created after the parent block. In this situation the FieldTemplateService
is not able to retrieve the ID of the block to be nested and set the TypeSelections
property on the parent block.
I would like to make sure that the blocks are created in the correct order, so that the template for the block type that is supposed to be nested is created before the parent block. Does anyone know how to solve this issue?
Litium version: 8.10.0