Looking for Content Item list of parts when inside the TypePartEditor for settings

Topics: Customizing Orchard, Writing modules
Sep 13, 2013 at 4:05 PM
Edited Sep 13, 2013 at 4:07 PM
I have created a Part with part settings that I manage with

IEnumerable<TemplateViewModel> TypePartEditor(...)

Is there a way to access the list of parts attached to the current Content Item from the method ?

Thanks
Coordinator
Sep 14, 2013 at 12:07 AM
contentItem.TypeDefinition.Parts will get you the list of parts defined by the content type. This is not necessarily the same as contentItem.Parts, but most of the time it will.
Sep 14, 2013 at 12:48 AM
Yes but inside TypePartEditor method I have no access to current editing content item
Coordinator
Sep 14, 2013 at 1:28 AM
But you have access to the type definition, don't you?
Sep 14, 2013 at 10:55 PM
Unfortunately not...or by some magical mystery trick I am not aware ? Any idea ?
I am presenting dozen of part names with no way to restrict this to parts in the current Content Model...
Coordinator
Sep 15, 2013 at 1:30 AM
What do you have access to?
Developer
Sep 15, 2013 at 2:31 AM
@CSDANT When inside the TypePartEditor method, there's no such thing as current content item.
Unfortunately the ContentDefinitionService does not supply the current content type being edited, so there's no (clean) way of getting that thing.
You may want to file a bug about this, because I can see that it makes sense to be able to no just access the part attached to some type, but the type itself as well. I mean, the information is available, and I guess it wouldn't hurt to supply it when invoking TypePartEditor.
Sep 15, 2013 at 9:39 AM