0
votes

I know in sitecore 6.5, you can Assign (through Configure tab) specific Templates that the user can use when inserting new items, but how do you do that in code?

I am creating regular folders in code, and I would like to assign specific templates to each created folder, but I am not seeing any "Assign","Configure" options for the "Item" class. Is there a way to do this?

2

2 Answers

1
votes

You are referring to the Insert Options of an item. That is stored on the item itself in the system field __Masters which is displayed as Insert Options if you check the Standard Fields checkbox on the View ribbon.

In that field you can add the template ID's of the templates you want allowed for insert (pipe separated if you have multiple ID's).

0
votes

When an item is selected in the Content tree, you can navigate to the "Configure" tab and choose "Assign" to add specific insert options to an item.

Additionally, you could create an insert option rule to dynamically assign insert options to items based on one or more conditions. You can find examples of several insert option rules here: /sitecore/Settings/Rules/Insert Options/Rules.

Insert option rules offer some advantages over setting insert options on specific items — for instance being able to package the insert options rules separately from the content items themselves. This also can be useful if someone deletes one of your content items by accident. If the insert options are set on the item itself, you will lose that logic if content editors delete that item. With insert option rules, you wouldn't necessarily need to recreate those insert options if your or someone else created a new item in its place and that new item met the conditions defined in your insert option rule.