Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Oct 26, 2017
(2 votes)

Hiding properties in the built-in Link dialog

What I wanted to do was to hide the Title property in the built-in Link dialog.

Image linkdialog.png

When searching here on World I found several posts that talk about extending EpiLink with custom properties, such as:

But if I only need to hide a property, could this not be done using an EditorDescriptor instead of creating a custom dojo editor, overriding the LinkModel and all the rest?...

I was happy when I discovered that the answer is Yes :) 

I tried some variations of the below before finding the correct TargetType and way to get at the properties. This solution worked for me in a site that runs CMS 10.7:

        TargetType = typeof(LinkModel),
        EditorDescriptorBehavior = EditorDescriptorBehavior.ExtendBase)]
    public class EpiLinkEditorDescriptor : EditorDescriptor
        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
            base.ModifyMetadata(metadata, attributes);
            foreach (var prop in metadata.Properties)
                if (prop.PropertyName == "Title")
                    prop.ShowForEdit = false;

This hides the property both in the Link dialog that opens when adding a link in the TinyMCE editor and in the Link dialog used when adding a LinkItem (the same model is used in both cases).

Image linkdialog_notitlefield.PNG

If there is a better way of doing this, please let me know!

Oct 26, 2017


Petra Liljecrantz
Petra Liljecrantz Oct 26, 2017 01:54 PM

Nice! I will definitely try this out to hide stuff from editors :) Thanks!

Please login to comment.
Latest blogs
Stop Managing Humans in Your CMS

Too many times, a content management system becomes a people management system. Meaning, an organization uses the CMS to manage all the information...

Deane Barker | Nov 30, 2023

A day in the life of an Optimizely Developer - Optimizely CMS 12: The advantages and considerations when exploring an upgrade

GRAHAM CARR - LEAD .NET DEVELOPER, 28 Nov 2023 In 2022, Optimizely released CMS 12 as part of its ongoing evolution of the platform to help provide...

Graham Carr | Nov 28, 2023

A day in the life of an Optimizely Developer - OptiUKNorth Meetup January 2024

It's time for another UK North Optimizely meet up! After the success of the last one, Ibrar Hussain (26) and Paul Gruffydd (Kin + Carta) will be...

Graham Carr | Nov 28, 2023

Publish content to Optimizely CMS using a custom GPT from OpenAI 🤖

Do you find the traditional editor interface complicated and cluttered? Would you like an editorial AI assistant you can chat with? You can!

Tomas Hensrud Gulla | Nov 28, 2023 | Syndicated blog