AI OnAI Off
Hi,
I think that you cannot use AvailablePageTypes in your scenario.
You could try use IValidate interface, to validate the structure during saving the page.
You could also subscribe to PagePublishing/PageSavingEvent and check if the structure is correct. If not, then reject changinges using e.CancelAction and e.CancelReason event parameters.
I did a thing to limit page types to be create only once.
http://world.episerver.com/blogs/per-nergard/dates/2014/6/limit-block-and-page-types-to-be-created-only-once/
Maybe it could be of use..
Hi and thanks for your answers.
I think I will go for the event solution.
Per --> Cool feature, I will look into to it :)
Pitty though that you can't customize AvailablePageTypes attribute..
I have a set of page types where:
PageA can create children of type PageA, PageB and PageC
PageB can create children of type PageA and PageC
PageC can create children of type PageA.
The thing I want is that PageB and PageC can only be created once and PageC can never be created before PageB.
PageA can be created as many times as the editor wants.
With the settings I have now, I can create:
PageA-->PageC-->PageA-->PageB.
So how can I accomplish that?! I don't want to check the ancestors in any events.
Is there a way to create a custom AvailablePageTypes?