Opticon Stockholm is on Tuesday September 10th, hope to see you there!
Opticon Stockholm is on Tuesday September 10th, hope to see you there!
Hello Linda,
The validation of the AllowedTypes attribute does get validated, but it is actioned as part of the save event for the entire page and manifests within the feedback dot near the publish button:
If you are restricting to pages but don't care what type of page it is, then you can use the PageReference type instead of ContentReference and that will restrict the content types that you can select for the property.
Thanks Mark!
We went for that option now, to use a PageReference instead, and it works well.
In the future there might be a need to also select files to have as a menu item, but we will cross that bridge when we get to it.
I thought that PageReference was obsolete by now. Or on its way to be at least. Any ideas of how long it will continue to live?
Hi Linda,
Optimizely usually decorate objects and methods with the [Obsolete] attribute along with advice if something has been made obsolete. In this case PageReference has not been decorated with an Obsolete attribute and is clearly still affecting UI with an intent. There are a number of methods on PageReference and behaviours around remote servers which have been marked as Obsolete so perhaps they have just reigned in the level of functionality this property type has, but I would consider it safe to use.
Hello!
I have a page type with a property that is an IList of items (used for a navigation if that is of interest):
The class used for the items contains a number of properties and also inherits another class in which there is a property of type ContentReference, to let the editor select pages to link to.
At the moment the editor can see all types of content in the selector. I want to limit it to only show pages, which can usually be done using [AllowedTypes(typeof(PageData))].
I tried adding it in the same way as I would do for a property in a content model class:
Although the AllowedTypes-attribute does not seem to work inside an IList?
Is this a bug? The Required and Display attribute that is on the same property is working.
Is there another way of making the select dialog only contain pages for a property in an IList?
Best regards,
Linda