November Happy Hour will be moved to Thursday December 5th.

limo
Sep 28, 2017
  2729
(2 votes)

Programmatically move or hide Episerver Forms Actors in Edit View

The built-in "Send Email"-Actor in Episerver Forms lives on the Settings tab in Edit View by default.

My customer wanted to move everything to do with sending a form to a separate tab, including the actors, and hide the webhook actor. 

The only solution I found online was to do it from the Admin interface, but I wanted to do this programmatically to avoid having to change the property setting from Admin after deploy to our various environments.

I tried using an Editor Descriptor but could not quite get it to work, so I asked the Episerver Developer Support and got the following solution from them that worked perfectly:

[EditorDescriptorRegistration(
        TargetType = typeof(IEnumerable<EmailTemplateActorModel>), 
        UIHint = "EmailTemplateActorEditor",
        EditorDescriptorBehavior = EditorDescriptorBehavior.OverrideDefault)]
    public class EmailTemplateActorEditorDescriptor : CollectionEditorDescriptor<EmailTemplateActorModel>
    {
        public EmailTemplateActorEditorDescriptor()
        {
            ClientEditingClass = "epi-forms/contentediting/editors/EmailTemplateActorEditor";
        }
        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            GridDefinition.GridSettings["richTextColumns"] = new[] { "body" };

            base.ModifyMetadata(metadata, attributes);

            metadata.GroupName = GlobalSettings.GroupNames.SendTab;
            metadata.Order = 50;

            //...if you want to hide the actor, set metadata.ShowForEdit = false;
        }
    }

(The Send Email actor contains a rich text editor, which is why the GridDefinition settings are needed when overriding the Metadata function above.)

I hope this can help others that would like to do the same thing.

Sep 28, 2017

Comments

Please login to comment.
Latest blogs
Adding Geolocation Personalisation to Optimizely CMS with Cloudflare

Enhance your Optimizely CMS personalisation by integrating Cloudflare's geolocation headers. Learn how my Cloudflare Geo-location Criteria package...

Andy Blyth | Nov 26, 2024 | Syndicated blog

Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog