This project is read-only.

How do I leave space open on a layout template as a sibling of another element?

Topics: Customizing Orchard, Writing modules
Sep 30, 2015 at 3:15 PM
When creating a layout template, I seem to have to leave open a leaf node, such as a column or row or entire grid, in order for a layout that uses it to be able to place anything there.

If I create a new layout template and drag out a Grid, position a 2-column Row inside, and then place an element (let's call it X) inside the left-side column, then pages that want to use this layout won't be able to place anything into the left-side column as a sibling of element X. But the right-side column still is open with that "Drag an item here" text, so it will be possible to add stuff there.

Is there a way to leave space open on the left side, for example below element X, in the same containing column element?

My current workaround is to position element X and then under that an entire Grid with a row and 1 column left open when creating the layout template.
Oct 1, 2015 at 12:20 AM
This is by design. In principle everything in the template is "sealed", except empty containers, which allow child elements to be added. so if you have a Column with element X, and you want users to be able to add more elements to this column from layouts using this template, you'll need to add a container to the template, such as another grid as per your work around. Or just another Canvas is what I would do.
Oct 1, 2015 at 1:44 AM
Thanks for your reply.

Adding an entire grid is a bit unwieldy as it introduces additional markup and possibly additional cell padding etc depending on the grid framework being used.

I wanted to try adding another canvas as you described, but I wasn't able to figure out how to do that. How do I add another canvas?
Oct 1, 2015 at 3:05 PM
I agree, a Grid would add way too much things. Canvas is the way to go. It should be available as an element in the Layouts category of the toolbox (depending on which version or branch you;re on - it's definitely part of the dev branch).
Oct 7, 2015 at 6:44 AM
I'm unable to find the Canvas element in the toolbox, I looked in both the 1.9.2 and dev branches.

Do I need to enable something?