Field settings, and updating..

Topics: Troubleshooting, Writing modules
May 28, 2013 at 2:28 PM
Edited May 28, 2013 at 2:37 PM
Hello,
I trigger additional action when user saves content type:
public class ContentTypeCreatingHandler: ContentDefinitionEditorEventsBase
{
    public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel)
    {
        var contentType = builder.Build();
        //accessing parts, fields etc.
    }
}
I've also custom field with settigns that is updated:
public class TextAreaBusinessTypeFieldEvents : ContentDefinitionEditorEventsBase
{    
    public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
    {
        if (builder.FieldType != "MyFieldField")
        {
            yield break;
        }

        var model = new MyFieldFieldSettings();
        updateModel.TryUpdateModel(model, "MyFieldSettings", null, null);

        builder.WithSetting("MyFieldSettings.Label", model.Label);

        yield return DefinitionTemplate(model);
    }
}
       
Unfortunately, TypeEditorUpdate is triggered first so my contentType variable has old field settings. I could manage it if I knew ContentType name when updating settings in PartFieldEditorUpdate, but there is no such an info. Can I access content type name when updating field settings?
May 28, 2013 at 3:53 PM
Edited May 28, 2013 at 3:53 PM
To delete, I've handled it.