November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi EJ,
You could hook to the IContentEvents.CreatingContent and check is the parent name "Secrets" and if not, then use the event argument to cancel the creation.
BUT maybe a better approach would be to have specific content type for your "Secrets" page/container page and then only allow certain content types below it using the AvailableContentTypes attribute, see documentation (the sample uses the attribute).
Hi Antti, Thank you for quick answer with both the solution I asked for and a best practices suggestion :)
I could create a container page under "Secrets" and allow only certaing content types below it, thats fine. But those content types could still be allowed under the other folders, right? Is it possible with an AllowedParentTypes sort of functionality?
Hi EJ,
You could also use the "Secrets" folder as a specific container content type OR page type, so you don't need to create any extra containers below that page unless it is meaningful.
I'm sure you have setup a local Alloy MVC site if not, now is the time to create and look at the StartPage.cs and how the AvailableContentTypes attribute is used on it, you would decorate your "MyPage" with the attribute and use the ExcludeOn property (and would list all the content types that "MyPage" content type should not be available, can get to be a long list :/ ), see documentation (scroll to AvailableContentTypesAttribute title).
Depending how your other content types limit what can be created under those types, you might be able to use the IncludeOn on the "MyPage" type to allow it under the "Secrets" content type BUT if any content type allows All, then your "MyPage" content type would be available there to so you would need to also use the ExcludeOn property. So the answer is that you need to test your types to find the correct definition/combination for AvailableContentTypesAttribute properties ;)
Hi all,
I have a tricky question here. Does anybody know how you can only allow a pagetype to be created under a certain folder in the folder-hierarchy?
Root
---> Home
---> Stuff
---> Secrets
---> ---> MyPage
So in the structure above, I want a page only to be allowed under the fodler named "Secrets". Is this possible to achieve? :)