6.6. Add Ability to Add Value Accessors to Tenant¶
Value accessor sets are configured on a tenant. Each tenant maintains its own value accessor sets. Value accessor sets are not shared between tenants.
Under the tenant, value accessor are organized by provider. Each provider has its own folder. In this folder are all of the value accessor sets that are based on value accessor sets that are relevant for the provider.
Hint
The steps in this section follow the pattern established in the section that covers implementing an endpoint. Since that section goes into detail on the reasons and benefits of this approach, that information will not be duplicated here.
6.6.1. Add template for value accessor set items folder¶
A new template is needed to represent the folder used to store value accessor sets for the file system provider.
In Sitecore, open Template Manager.
Navigate to Templates > Data Exchange > Providers > File System > Folders.
Add the following template:
Name File System Value Accessor Sets RootBase template Templates > Data Exchange > Framework > Folders >Folders for Data Access > Value Accessor Sets forProvider RootLocation Templates > Data Exchange > Providers > File System > FoldersNote the id for this template, because you will need it later.
Set the icon for this template to
Office/32x32/folder_open.png
.
6.6.2. Add insert option for adding value accessor set items to folder¶
Adding an insert option to the folder where value accessor set items are stored makes it easier for people to add new value accessor set items.
Add the Standard Values item.
Navigate to the Standard Values item.
In the Insert Options, assign the template Templates > Data Exchange > Providers > File System > Data Access > Array Value Accessor Set.
In the Insert Options, remove the template Templates > Data Exchange > Framework > Data Access > Value Accessors > Value Accessor Set.
Note
The default value accessor set template is removed in order to reduce complexity for the person configuring the value accessor set.
When using the provider, there is no reason to use the default value accessor set. The custom value accessor set should be used.
6.6.3. Add command template for value accessor set items folder¶
A command template ensures the folder used to organize the value accessor set items has a name that is consistent with other framework components.
In Template Manager, navigate to Templates > Branches > Data Exchange > Providers > File System > Commands.
Add the following item:
Template Create Item Without Prompting for Name Branch Name File System Value Accessor Sets Root Navigate to Templates > Branches > Data Exchange > Providers > File System > Commands > File System Value Accessor Sets Root > New Item Settings.
Set the following field values:
Field Value Name for new item File SystemTemplate for new item Templates > Data Exchange > Providers > File System >Folders > File System Value Accessor Sets Root
6.6.4. Add insert option for command template¶
The insert option will allow users to add one, and only one, folder for organizing value accessor set items for the provider, per tenant.
Open Content Editor.
Navigate to sitecore > system > Settings > Rules > Insert Options > Rules > Data Exchange - File System provider.
On the field Rule, click Edit rule.
Click Add a new rule.
Add the action add specific insert option.
This action requires you specify a template. Select Branches > Data Exchange > Providers > File System > Commands > File System Value Accessor Sets Root.
Add the condition where the item template is specific template.
This condition requires you specify a template. Select Data Exchange > Framework > Folders > Folders for Data Access > Value Accessor Sets Providers Root.
Add another condition. Add the condition where the result of the expression query exists.
This condition requires you specify an expression. Enter
./*[@@templateid='TEMPLATE-ID']
, being careful to replaceTEMPLATE-ID
with the id from the template you created named File System Value Accessor Sets Root.Negate the condition by clicking where.
Note
Negating the condition changes where to except where.
Name the rule Value Accessor Sets Providers Root.
Click OK to save the rule.
Save the Sitecore item.
6.6.5. Test the Configuration¶
The following steps explain how to confirm your configuration is working properly.
- In Content Editor, navigate to sitecore > system > Data Exchange.
- Select a tenant.
- Under the tenant, navigate to Data Access > Value Accessor Sets > Providers.
In the insert options, the option to insert File System Value Accessor Sets Root is available.
- Use the insert option to create a new item.
A new item named File System is created. The insert option for the endpoint item is available.
If you navigate back to the Providers item, the insert option for File System Value Accessor Sets Root is no longer available.
- Delete the item File System.
Once again, in the insert options, the option to insert File System Value Accessor Sets Root is available.