Last active
August 29, 2015 14:07
-
-
Save jasonicarter/efd6ba761f422062face to your computer and use it in GitHub Desktop.
Remove Insert Option item from the available list if selected item already has children of the specific item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rules -> Insert Options -> Rules and create a new rule for "item xyz" | |
Then follow along with the code below to set up the rule | |
'where' the item is the 'home' item or one of its subitems | |
'and' 'except where' the item template is 'item xyz' | |
'and' 'except where' the result of query './*[(@@templateid='{item-xyz-template-ID}')]' exists | |
add 'item xyz' insert option | |
Basically: No parent should have more than one item with template id of "item xyz" as a child, | |
so if it already does, remove "item xyz" as an option in Insert Options list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment