SaaS CMS has officially launched! Learn more now.

limo
Oct 26, 2017
  6891
(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:

    [EditorDescriptorRegistration(
        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

Comments

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
Optimizely London Dev Meetup 11th July 2024

On 11th July 2024 in London Niteco and Netcel along with Optimizely ran the London Developer meetup. There was an great agenda of talks that we put...

Scott Reed | Jul 19, 2024

Optimizely release SaaS CMS

Discover the future of content management with Optimizely SaaS CMS. Enjoy seamless updates, reduced costs, and enhanced flexibility for developers...

Andy Blyth | Jul 17, 2024 | Syndicated blog

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

Hello and welcome to another instalment of A Day In The Life Of An Optimizely Developer. Last night (11th July 2024) I was excited to have attended...

Graham Carr | Jul 16, 2024

Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024