Try our conversational search powered by Generative AI!

Unable to move built-in properties to the settings header in EPiServer 9 CMS

Vote:
 

As part of my project requirement, I need to move an in built property in the CMS editor to “Settings” Tab. Property details are given below.

 Property Name : iroutable_routesegment

Display Name : Name in URL

 

I have created a custom implementation on IMetadataExtender as given below and the same has been initialized using a custom implementation of IInitializableModule.

 

public void ModifyMetadata(ExtendedMetadata metadata, IEnumerable attributes)

       {

 

           foreach (ExtendedMetadata property in metadata.Properties)

           {

               if (property.PropertyName.ToLower() == "iroutable_routesegment")

               {

                   property.GroupName = SystemTabNames.Settings;

                   break;

               }

 

           }

 

       }

 

I have also tried to override the ModifyMetadata method of EditorDescriptor class too.

However, the property is not getting moved to the Settings tab. I am using EpiServer 9.7.

 

Can some one help us on this?

#149343
May 30, 2016 13:17
Vote:
 

What dose you implementation of IInitializableModule look like? Dose it use the ModuleDependency attribute?

[ModuleDependency(typeof(EPiServer.Cms.Shell.InitializableModule))]
#149357
May 30, 2016 15:51
Vote:
 

Yes Oskar. I have given the same as given below.

[ModuleDependency(typeof(EPiServer.Cms.Shell.InitializableModule))]

#149358
May 30, 2016 15:54
Vote:
 

Then I’m lost. Your code looks fine and should work. I use similar code in one of my projects to move the category property.

#149364
May 30, 2016 16:38
Vote:
 

Hi, Vishnudas,

It looks like you can add to Page header, but not move the built-in properties out of it. When I tried both, from tabs to header works, but not the other way around:

public class SiteMetadataExtender : IMetadataExtender
    {
        public void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            foreach (ExtendedMetadata property in metadata.Properties)
            {
                // this works
                if (property.PropertyName == "Heading")
                {
                    property.GroupName = SystemTabNames.PageHeader; 
                    property.Order = 3;
                } 
                // this doesn't
                else if (property.PropertyName == "PageVisibleInMenu")
                {
                    property.GroupName = SystemTabNames.Settings;
                }
            }
        }
    }

    [InitializableModule]
    [ModuleDependency(typeof(EPiServer.Cms.Shell.InitializableModule), typeof(DependencyResolverInitialization))]
    public class SiteMetadataExtenderInitialization : IInitializableModule
    {
        public void Initialize(InitializationEngine context)
        {
            if (context.HostType == HostType.WebApplication)
            {
                var registry = ServiceLocator.Current.GetInstance<MetadataHandlerRegistry>(); 
                registry.RegisterMetadataHandler(typeof(ContentData), new SiteMetadataExtender());
            }
        } 
        public void Preload(string[] parameters) { } 
        
        public void Uninitialize(InitializationEngine context) { }
    }

We have already had a discussion about how to make some of these properties culture specific: http://world.episerver.com/forum/developer-forum/EPiServer-7-CMS/Thread-Container/2014/1/Override-built-in-page--block-properties/. You could probably try with a similar approach, but it does not look like a bright idea (as Per-Magne wrote, use at your own risk). 

Maybe you can try a different approach, what is it that you wanted to achieve by moving this to Settings?

#149406
May 31, 2016 14:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.