Skip to content

Instantly share code, notes, and snippets.

@jasonicarter
Last active August 29, 2015 14:07
Show Gist options
  • Save jasonicarter/efd6ba761f422062face to your computer and use it in GitHub Desktop.
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
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