Element Settings

Topics: Customizing Orchard
Jun 19, 2015 at 4:37 PM
Is there a method for adding tabs to the editor of an element? I need to add some settings to the element but want to have them in a separate tab similar to the form elements such as email. Thank you.
Jun 20, 2015 at 8:15 AM
Edited Jun 20, 2015 at 8:15 AM
You can achieve that by setting the Metadata.Position property on the editor shape you return from your element's driver. For example:
protected override EditorResult OnBuildEditor(FormElement element, ElementEditorContext context) {       
    var editorShape = context.ShapeFactory.EditorTemplate(TemplateName: "MyElementEditor", Model: myViewModel);

    editorShape.Metadata.Position = "MyTabName:3";

    return Editor(context, editorShape);
The first part of the position value will be used for the tab name, and the second part to position that tab.
If more drivers use the same tab name but different positions, either the first or the last one will be used (don't know offhand).