开发者

manually render an item in orchard connected using the science project sockets and connectors

开发者 https://www.devze.com 2023-03-28 18:27 出处:网络
In my project I have overridden the display at the widget level in order to precisely control the markup being produced. The problem I have now is that I can\'t work out how to render items which are

In my project I have overridden the display at the widget level in order to precisely control the markup being produced. The problem I have now is that I can't work out how to render items which are connected using Socket -> Connector -> Socket (in order to achieve a 1-many relationship of items)

http://scienceproject.codeplex.com/wikipage?title=Mechanics

If I insert the default Widget rendering line

@Display(Model.Content)

I can see using the shape tracer that items of the Sockets are being rendered using the following View

~/Modules/Downplay.Mechanics/Views/Socket.cshtml

What I want to be able to do is do this开发者_开发问答 manually. I have worked out that

Model.Content.ContentItem.MyType.ContentItem.Parts[8]

is of type Downplay.Mechanics.Models.SocketsPart but Connectors is null and I can't see any other reference to Sockets. Can anyone tell me how I would access the connected sockets?


The answer was that the model included a list of items, if these were iterated through, the items i needed were the items with a ConnectorType set.

<ul class="assets">
    @{
        foreach (var item in Model.Content.Content.Items) {
            if (item.ConnectorType != null)
                {
                @Display.Socket(Content: item)
        }
                }
        }
    </ul>
0

精彩评论

暂无评论...
验证码 换一张
取 消