Modify meta data for Name property in UI

Ted
Ted
Vote:
 

I'm trying to change the name and tooltip for the Name property of specific content types.

I'm able to change other types of meta data, for example to hide native properties in the UI, but I can't seem to do it for the Name property.

My code looks like the following:

public void ModifyMetadataForNameProperty(ExtendedMetadata metadata, IEnumerable attributes)
{
    var nameProperty = metadata.Properties.OfType()
                                          .FirstOrDefault(prop => 
                                              prop.OwnerContent is MyContentType && 
                                              prop.PropertyName == "icontent_name");

    // Here I have the Name property, populated with the default meta data

    if (nameProperty != null)
    {
        nameProperty.DisplayName = "Custom name";
        nameProperty.ShortDisplayName = "Name";
        nameProperty.EditorConfiguration["tooltip"] = "This should be the new tooltip for the Name property for MyContentType instances";
    }
}

Any clever ideas are much appreciated! :)

#118702
Mar 12, 2015 9:13
Vote:
 

You could modify your language files in order to do that I think

<languages>
  <language name="English" id="en">
    <contenttypes>
      <mycontenttype>
        <properties>
         <icontent_name>
            <caption>My special name</caption>
            <help>My really helpful help</help>
          </icontent_name>
        </properties>
      </mycontenttype>

...

#118705
Mar 12, 2015 9:50
Ted
Vote:
 

Thanks for the reply, Per! That's what I'm doing today, but I wanted to be able to do it with an attribute on the content type. And also I'm just curious if it can be done. :P

#118706
Edited, Mar 12, 2015 10:00
Vote:
 

Actually, I'm pretty sure that I investigated this a few weeks back and came to the conslusion that changing the DiplayName property on the metadata has no effect. The reason for this is that the language settings for the content type is applied over the metadata in the view, so they way to go is probably to modify this through the language files.

#118708
Mar 12, 2015 11:10
Ted
Vote:
 

Thanks!

I think I'll look into a custom localization provider instead, that way I can still make it dynamic - for example to use a site setting (content property) as the label.

#118709
Mar 12, 2015 11:17
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.