This project is read-only.

Alternate view for field editor

Topics: Customizing Orchard
Jun 5, 2011 at 10:01 PM

Hi, I would like to override text field editor. I created my view and I modified file (Order of field was changed). Unfortunatelly I don't know where should I paste my custom template.

Jun 5, 2011 at 11:13 PM

Into your custom Theme, in the same folder it was under in the original module. See tutorials in documentation for creating a theme.

Jun 6, 2011 at 5:49 PM

Ok, I wan't to replace Common Text Field. I have created the following entry in

<Place Fields_Common_Text_Edit-Color="Content;Alternate=Fields_Common_Text_Edit__Color" />  
And I created file Fields.Common.Text.Edit-Color.cshtml and place it in:
but still I don't see it.
Jun 6, 2011 at 6:31 PM

That's because the admin theme has a higher priority than your theme. Overriding admin templates is not a supported scenario at this point. It's doable by implementing a theme selector and giving your theme a higher priority though.

Jun 6, 2011 at 7:01 PM

I don't understand.

I can change location of field by modify in TheAdmin theme.
I can change theme of generic text field editor by placing file Fields.Common.Text.Edit.cshtml in ~/Themes/TheAdmin/Views/EditorTemplates

I can't only specify alternative template for specific filed name.

Jun 6, 2011 at 7:24 PM

You are not supposed to modify what's in TheAdmin: what's going to happen next time you update the application? Well, your changes are going to get overwritten. That's why you should work in your own theme. I'm not exactly sure why what you're trying to do isn't working but as I said, not supported. If I had to guess I would say that the name of the alternate may not be right.

Jun 6, 2011 at 7:26 PM

Can you explain what exactly you're trying to do, so that maybe we can find a different solution for the same scenario?

Jun 6, 2011 at 8:04 PM

I have my custom type with few text fields.

I'd like to create custom editor for one of this fields.

Jun 6, 2011 at 8:09 PM

That much I had understood :) My question was more why do you want to do that? What will this achieve? We might find another way.

Jun 1, 2012 at 2:51 PM
Edited Jun 1, 2012 at 2:53 PM

Simply overriding specific field editors seems not to be possible now neither. I wanted to override the Text field's editor shape from a module, but for only that specific content type's field. Fields.Common.Text.Edit.cshtml override works, but it overrides all editors. Despite the Fields.Common.Text-ContentType-FieldName.cshtml pattern working for display shapes, Fields.Common.Text.Edit-ContentType-FieldName.cshtml doesn't.

Anybody with a clue? Only the overriding from remains, but it's less comfortable (the model object such a template gets is not the same statically types one the original editor template gets).

Jun 1, 2012 at 7:27 PM

Overriding admin templates is tricky. I think you found the best way for the current build.

Jun 1, 2012 at 8:45 PM