Orchard-Training-Demo-Module | Demo Orchard Core CMS and Orchard
kandi X-RAY | Orchard-Training-Demo-Module Summary
kandi X-RAY | Orchard-Training-Demo-Module Summary
Demo Orchard Core CMS and Orchard 1.x module for for you to become an Orchard developer. This module completes the training materials under https://orcharddojo.net.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Orchard-Training-Demo-Module
Orchard-Training-Demo-Module Key Features
Orchard-Training-Demo-Module Examples and Code Snippets
Community Discussions
Trending Discussions on Orchard-Training-Demo-Module
QUESTION
I'm trying to create a custom module which includes a content type (Project) which contains a content-part (ProjectPart). Projects will be created by admin. And the goal is to show these created project on a specific page.
When I try to instantiate a new project on the admin menu, I only see one field (Description). Other fields are not shown.
I followed the steps (starting from PersonPart.cs) in "Lombiq.TrainingDemo" project, and managed to create a custom module which includes a content type (Project), a content part (ProjectPart). Comments in the project claim that we can create an instant with all fields. But this is not true for my case.
Here is my code:
https://gist.github.com/vogucore/efb0096e349591c235103e4f3f9e60d1
Here you can see what I exactly mean.
I expect to see & edit all of its field, but only "Description" field is shown up.
Could you please tell me whether I'm missing something, or the explanation in the project is not true?
Thanks in advance. Peace! (;
...ANSWER
Answered 2019-Aug-23 at 20:04It seems you are confusing properties of a content part with fields of a content part, which are two different concepts in Orchard.
Parts are regular C# objects that can have regular C# properties. Using such properties is the valid and mainstream way for developers to extend the CMS and build custom parts in Orchard.
Fields are smaller units of contents (typically a single string, or a number, or an image, etc.) that can be dynamically added to a part, trough code or through the admin's content type definition editors. They have the advantage that the administrator of the site can add, remove and modify them at runtime.
It's very understandable that you'd confuse them: they are both name/value thingies that you can attach to a part. In terms of actual usage, a good way to choose between the two is to ask the following question:
Is this a core property that is firmly attached to the part concept I'm building, or something that would be nice for administrators to attach to it if it makes sense to them?
For example, if I build a commerce product part, it would make sense that the SKU and price would be part properties. Now a product photo is different in that not all products may necessarily have a photo, some may have several, may be videos, who knows? It's just not an intrinsic property that makes a product a product. So make that a field (a media picker field to be specific).
To get back to your specific example, you should not be adding that field in your migration: it's basically creating something that looks like it's your Description
property, but actually is a Description
field, in addition to your property of the same name.
The reason why your part properties don't appear on your editor is that you aren't done with your part. You still need to build a driver, and views for it (the field didn't need that because they were already built by whoever built that field).
As a side note, I think the good Lombiq folks made a lousy choice by giving that Biography
property the TextField
type. It's very confusing, and should really be a string, in my opinion, and so should your Description
property.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Orchard-Training-Demo-Module
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page