November Happy Hour will be moved to Thursday December 5th.

Customizing "Restricting content reference properties"

Vote:
 
I have the following code:
[AllowedTypes(typeof(TagPage))]
public virtual IList Tags { get; set; }

Does anyone know how to customize the part where it says “You can add these content types [Type]” in the editor when using a list of content references?
Where does [Type] come from, and how can it be changed?
Mine just says “Page” and it is quite misleading..

I want it to write out something lige "Tag Page" in allowed types in the editor
Is there an attribute or something on the IList, which can be customized to specify the type of page allowed?
#151967
Edited, Aug 11, 2016 10:51
Vote:
 

Not sure cause I haven't tested it before, but I bet it gets the DisplayName attribute for the page(s) added in the AllowedTypes.

#151973
Aug 11, 2016 11:05
Vote:
 

It does not work. I just tried to change the DisplayName from "Tag Page" to "Tag-Page" (in case it was the space that did it), but that didn't have any effect.

Maybe it is simply because my TagPage has PageData as base class...?

[ContentType(
        DisplayName = "Tag Page", 
        GUID = "e36d32f2-34e2-45e7-ae3d-cfe853282f01", 
        Description = "Tag landing page")]
    [AvailableContentTypes(Availability.None)]
    public class TagPage : PageData
    {
        
    }
#151976
Edited, Aug 11, 2016 11:16
Vote:
 

Hm, ok. Might fetch it from the localized xml files then? Is there any reference for the tag page in /Resources/LanguageFiles/ContentTypeNames.xml in your solution?

#151978
Aug 11, 2016 12:20
Vote:
 

I don't seem to have that folder. Where in the solution should it be located?

#151988
Aug 11, 2016 15:03
Vote:
 

The default location is ~/Resources/LanguageFiles, but the location is configurable in web.config under the localization node

#151991
Aug 11, 2016 15:26
Vote:
 

This text is fetch from a language file that is an embedded resource in EPiServer.Cms.Shell.UI.dll.  You can change this by adding the following to one of your language files:

      <language name="English" id="en">
        
        <episerver>
          <cms>
            <widget>
              <contentreferencelisteditor>
                <allowedtypes>You can add these types, dude!</allowedtypes>
              </contentreferencelisteditor>
            </widget>
          </cms>
        </episerver>
        ...

This will change the text for all content reference list editors though.

#152004
Aug 12, 2016 8:13
Vote:
 

Then it does not really solve the problem if one would want more than one reference list?

#152007
Aug 12, 2016 9:29
Vote:
 

Ah,
I misunderstood your question.
To change the [Type] values, add localizaed values to your language file. For Your "Tag page", it would be something like:

    <contenttypes>
      <tagpage>
        <name>Tag page</name>
        <description>Something something something</description>
      </tagpage>

Using "DisplayName" does not work for this purpose

#152008
Aug 12, 2016 9:43
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.