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

Topics: Customizing Orchard, Writing modules
Sep 13, 2013 at 3:05 PM
Edited Sep 13, 2013 at 3: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 ?

Sep 13, 2013 at 11:07 PM
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 13, 2013 at 11:48 PM
Yes but inside TypePartEditor method I have no access to current editing content item
Sep 14, 2013 at 12:28 AM
But you have access to the type definition, don't you?
Sep 14, 2013 at 9: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...
Sep 15, 2013 at 12:30 AM
What do you have access to?
Sep 15, 2013 at 1: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 8:39 AM