Try our conversational search powered by Generative AI!

limo
Sep 28, 2017
  2582
(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
Optimizely Forms: Safeguarding Your Data

With the rise of cyber threats and privacy concerns, safeguarding sensitive information has become a top priority for businesses across all...

K Khan | May 16, 2024

The Experimentation Process

This blog is part of the series -   Unlocking the Power of Experimentation: A Marketer's Insight. Welcome back, to another insightful journey into...

Holly Quilter | May 16, 2024

Azure AI Language – Sentiment Analysis in Optimizely CMS

In the following article, I showcase how sentiment analysis, which is part of the Azure AI Language service, can be used to detect the sentiment of...

Anil Patel | May 15, 2024 | Syndicated blog

Optimizely Data Platform Visitor Groups now supports multiple instances

The module V2.0 now supports multiple Optimizely Data Platform instances, allowing personalized content based on real-time segments and profile dat...

Andrew Markham | May 15, 2024 | Syndicated blog

IP block for edit and admin in DXP

Why IP-blocking edit/admin? A hacker can try to guess user names and passwords to gain access to your site. This risk can be minimized in a couple ...

Daniel Ovaska | May 15, 2024

Do not upgrade to EPiServer.CMS.Core 12.21.4 without reading this!

Todays update of EPiServer.CMS.Core 12.21.4 alters default sort order in an unexpected way, when you are working with muligple languages and have...

Tomas Hensrud Gulla | May 14, 2024 | Syndicated blog