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.
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.
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
{
...
}
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.
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.
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:
This works great, but the editor "hints" in Edit Mode are not really helpful: