November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
I should point out I've already check that this interface is only applied to objects that inherit from PageData.
And the reason for not using a base class is I want to be able to do something like this:
class BasePage : PageData class StandardPage : BasePage
class FeaturePage : BasePage class NewsListPage : StandardPage, IListPage class PromotionListPage : FeaturePage, IListPage
Where IListPage is segregating a specific piece of functionality, but doesn't then enforce inheritance of extra unwanted properties.
My guess is that the type of interface you send in is not a page model, i.e. it does not inherit from IContentData which the GetChildren method needs in order to list the children of the root page. Why, I don't know though.
And you do get errors if you watch the network tab of the Chrome developer tools.
/T
AllowedTypes doesn't work with base classes either. So there seems to be something that isn't working correctly.
I was using the following to restrict types in my ContentAreas, just had to rename it to AvailableContentAreaTypesAttribute now due to naming conflict with AvailableContentTypes in EPiServer 7.5.
It works with interfaces aswell.
http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=77678
**Note I have also updated the contentArea.Contents to contentArea.Items.Select(item=>item.GetContent())
As the Contents property which used to return the actual IContent items is no obsolete in 7.5 and the Items property returns ContentAreaItems, who's actual content is what you want to compare.
To use base classes, you just need to register a UIDescriptor so that the UI knows about this type. We are investigating if we can do this automatically for all base types for content types.
[UIDescriptorRegistration]
public class YourBaseClassUIDescriptor : UIDescriptor
{
}
For interfaces, there is a work around described in the comments section of my blog post:
http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2013/12/Restriction-of-content-types-in-properties/
Thanks Linus. I've missed that conversation! Good to know that we can fix it.
I have a property with an allowed type restriction:
Don't get any code errors and all seems fine until I actually try and set the content in the editor, when it just hangs on content selection. Works fine if I remove it.
I could maybe look to create an abstract class that inherits from PageData and maybe that would work, but that then enforces an inheritance hierarchy that I don't actually want. In some ways it's a bit of a shame there is no IPageData interface that my interface could inherit from.