This project is read-only.

How to access type name from TypePartEditorUpdate

Topics: Customizing Orchard
Nov 15, 2012 at 9:28 AM

In a custom module, I've created a class which extends ContentDefinitionEditorEventsBase in order to save some settings for a part. In TypePartEditorUpdate I'm trying to save some non-content data which is related to the type but I can't find a convenient way of accessing the type name from this method.

Is this possible somehow?

Nov 16, 2012 at 9:28 PM

Did you look at how other part types that save settings are doing it? Autoroute for example, or Body.

Nov 22, 2012 at 6:58 PM

I looked at other modules as a starting point, but none seem to be accessing the content type name from TypePartEditorUpdate. I can see that the content type name is available from TypeEditorUpdate (via ContentTypeDefinitionBuilder) but at this point other resources are unavailable.

Nov 22, 2012 at 7:09 PM

What other resources? Can you explain in more details what exactly you are trying to do?

Nov 22, 2012 at 10:00 PM

Sure, I'm trying to create non-content data, based on settings entered for a part, which is linked to a content type (by using the content type name as a foreign key).

By "other resources" I just mean that, when saving settings for a part, the most recent settings for the part are unavailable in the TypeEditorUpdate method because it's called before TypePartEditorUpdate i.e. before the most recent values for the settings have been persisted to db.

If the name of the content type was somehow accessible in TypePartEditorUpdate along with the most recent settings then all the necessary data would be available to create the records.

Nov 23, 2012 at 2:58 AM

Thanks, but I still don't understand why you need, at the moment when you're persisting the settings, to know anything else than what's in the settings form. Seems like any other information would only be required later, when the part is actually being used.