This project is read-only.

OrchardCMS CustomType Getting Attached Layout Part

Topics: Customizing Orchard
Sep 16, 2016 at 5:40 PM
I am trying to build a component for my Orchard Website.
I am using a Custom ContentType and shape tracing.
Its going exactly as I expect, but one of the parts. is the layout part.
All the other fields I am using to generate the HTML structure of the component.
In the center of it, I was to display whatever the user puts into a Layout Part inside of the middle of it.

The ContentType has the following fields (which I am using to build the html):
ID (Text)
ModuleType (Text)
BackGroundImage MediaImage

and the following "Parts"
Layout <-- I NEED THIS!! so I can place in a div in the html I build in the cshtml. with
BuildDisplay(layoutPart, "#display type#")

What I need is the Part that is Layout from the Model object.
I have tried looking through the docs, and googling it. I suspect that since I am new to both Orchard and Razor I don't have the right vocabulary yet.

I tried cutting and pasting my code for the cshtml stackexchange wont let me in a nice format so this is the best I can do.
@using Orchard.Utility.Extensions;
@using Orchard.ContentManagement
@using Orchard.Core.Title.Models
@using Orchard.Layouts.Models

if (Model.Title != null) {
Layout.Title = Model.Title;


var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify();

var tag = Tag(Model, "div");
var id = Model.Content.Items[0].ContentField.Value;
var css = Model.Content.Items[1].ContentField.Value;
var nextID = Model.Content.Items[2].ContentField.Value;
var backgroundPath = Model.Content.Items[3].ContentField.FirstMediaUrl;

if (css=="module-hero")
css="module-hero fullheight parallax";

//How do I get the part of the content type (some of the things I have tried below, without success)
//var parallexContent = Model.Content.As<LayoutPart>();
//var parallexContent = Model.Content.Items[4].As<LayoutPart>();


@if (Model.Meta != null) {
<div class="metadata">

<div id="@id" style="background: url(@backgroundPath)" class="@css">
<div class="container">
<div class="row">
<div class="col-sm-12 m-t-250">    
@Display(BuildDisplay(parallexContent, "#display type#")) <-- So I can fill out this here
<div class="btn-list">
<a href="#@nextID" class="btn btn-outline smoothscroll"><i style="font-size: 60px" class="fa fa-angle-down"></i></a>

@if(Model.Footer != null) {