Orchardcore: What is a shape?

Created on 6 Nov 2017  路  8Comments  路  Source: OrchardCMS/OrchardCore

Is the object that's accessible to the template or is it something else?

I read this and I still can't figure it out.

P3 documentation

All 8 comments

Everything in this video should be in the documentation

Two years after this question and I still don't understand Shape fully lol.

Simple answer: It's a view model ... to be continued

The way I understand a shape is that it's a view model with metadata (a property that all shapes have). This metadata contains information the view engine uses to know which template to use to render the shape. When executing the selected template, the view engine passes in the shape as the model for said template.

In addition, shapes can have child shapes, allowing the system to compose an entire tree of shapes with the Layout shape typically being at the root.

There's more to it, but looking at shapes like this always helped me understand them enough to work with them effectively.

I think what makes it unclear is the role of zone in the shape (https://github.com/OrchardCMS/OrchardCore/issues/4121#issuecomment-541442390)

It's all about what type of Shape the Model is made of for each template. Sometimes Model if a Zones shape, like in your example.

It's not obvious when you can use Model.Content or use Model.ContentItem.Content to access your Parts.

But I think it's just rooted on my shallow understanding of Shape. I mean I can use them - I just don't fully understanding how the rest of the system interact with Shape.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

szilardcsere89 picture szilardcsere89  路  3Comments

randaratceridian picture randaratceridian  路  3Comments

ns8482e picture ns8482e  路  4Comments

hishamco picture hishamco  路  3Comments

deanmarcussen picture deanmarcussen  路  3Comments