This project is read-only.

Custom field type not showing up in editor

Topics: Troubleshooting, Writing modules
Sep 17, 2014 at 9:42 PM
Edited Sep 18, 2014 at 12:57 PM
I'm creating a custom field type based on the following example:

I can add the field to a content type and I can see that the FieldDriver.Display() method is being called in the "Content" overview page if there is a contenttype utilizing my custom field.

However when I create a new instance for the contenttype or when I go to an edit screen for the contenttype I can't see my field.

The .cshtml template file is located in "/Views/EditorTemplates/Fields/Custom.Dictionary.cshtml" and my file is as follows:
    <Place Fields_Custom_Dictionary_Edit="Content:2.5"/>
    <Place Fields_Custom_Dictionary="Content:2.5"/>
As I said, the Display() method for the driver get's called, the Editor() method doesn't.

Any help would be greatly appreciated, I'm very stuck on this!
Sep 18, 2014 at 4:55 AM
You might have made a mistake with your path: "/Views/EditorTemplates/Field/Custom.Dictionary.cshtml" should probably be like "/Views/EditorTemplates/Fields/Custom.Dictionary.cshtml".
Sep 18, 2014 at 12:57 PM
Nice catch haha, but it's actually "Fields" in my environment, the above is a typo.
Sep 18, 2014 at 1:26 PM
Ah found it. It still listed DateTimeField for the ContentDefinitionEditorEventsBase implementation.
        public override IEnumerable<TemplateViewModel>
          PartFieldEditor(ContentPartFieldDefinition definition)
            if (definition.FieldDefinition.Name == "DateTimeField")
                var model = definition.Settings.GetModel<DictionaryFieldSettings>();
                yield return DefinitionTemplate(model);
Marked as answer by RobertWebcare on 9/18/2014 at 6:22 AM
Sep 18, 2014 at 9:14 PM
Aha. Glad you found it.