Tweak messaging around AllowedTypes to be more editor-friendly?

Vote:
 

Is there a way that we can make the messaging in the Edit UI a bit more user friendly when configuring AllowedTypes?

For example, I have this property, which allows an abstract base PageData class, and restricts a SiteSettingsPage:

[AllowedTypes(typeof(BasePageData), RestrictedTypes = new[] { typeof(SiteSettingsPage) })]
public virtual IList<ContentReference> MainNavigation { get; set; }

This works great, but the editor "hints" in Edit Mode are not really helpful:

#231171
Edited, Nov 20, 2020 5:22
Vote:
 

I want to add 1 to this because I've seen the message of "You can add these content types" is limited to "Page" or "Block" and not the actual type of the page or block.

#231293
Nov 24, 2020 3:54
Vote:
 

It is the actual page name if the Type that you use is decorated with [ContentType] attribute.

However if it's an abstract class like BasePageData then we don't have a uiDescriptor registered for it and will fallback to it's base class which is PageData for which we do have a uidescriptor registered EPiServer.Cms.Shell.UI.UIDescriptors.Internal.PageUIDescriptor

It depends what you expectations are:

1) Would you expect to see the typeidentifier like customername.productname.models.pagebase, or

2) You would expect to expand the base type with all derived types.

Please let me know if it's 1 or 2 and I can tell you what to do in each case.

#232959
Dec 02, 2020 12:50
Vote:
 

Hey Bartosz!

I think it my case, option 1 would be the most user-friendly, only because the BasePageData could be inherited by many other page types, and that messaging could get overwhelming to the editor.

With that said, it would be nice to know how to do it for both options. :)

Also:

"It is the actual page name if the Type that you use is decorated with [ContentType] attribute."

I'm not seeing that this working in my example above. I'm using the page type "SiteSettingsPage" as a restricted type, and it's still rendering in the UI as just "Page".

[ContentType(DisplayName = "Site Settings Page", GUID = "55753409-886d-40d1-a1f1-aa430e856e3f", AvailableInEditMode = false)]
public class SiteSettingsPage : BasePageData
{
    ...
}
#232966
Dec 02, 2020 16:26
Vote:
 

Yes, the problem is that BasePageData inherits from PageData and we have descriptor for that one.

You would have to either create a uidescriptor for your base type or create an interface like IBasePageData that should be implemented by BasePageData and used in AllowedTypes attribute. The interface is outside of the inheritance chain and will not fallback to the default uidescriptor.

#232993
Dec 03, 2020 6:49
Vote:
 

@Chris: Have you tried adding the name of your content type SiteSettingsPage to the language files? I do not think [AllowedTypes] will pick up the name used in the [ContentType] attribute.

I reported this as a bug in September, it is now public here CMS-16901.

#232997
Edited, Dec 03, 2020 7:58
Vote:
 

Yeah, Tomas is right. We had a few issues around ContentType's display name that were closed as won't fix..

Adding BasePageData to language files works fine. I've just checked that. 

#233923
Dec 03, 2020 9:33
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.