What is the standard value in Sitecore?
Standard values were first introduced in Sitecore 5.3 to overcome some of the issues experienced with the predecessors of standard values – “Masters”. In Sitecore 6 masters was completely removed and the concept of standard values took over.
Standard values are a way of having the default or fallback values for fields in Sitecore, meaning that when items are created, you can specify a field value that should be used by default. This does not only account for custom fields you build but also standard fields in Sitecore such as presentations and insert options. This means that you can specify a value on the standard values, and when you create a new item which inherits from this template, it will by default use the values specified on the standard values.
How to create Standard Values in Sitecore?
You create standard values on the given template you want to add standard values for. Go to the template and click the options tab then click the standard values button.
If the options tab doesn’t appear, when you have selected the template, this is probably because you haven’t selected the builder tab, as it is only when this editor tab is selected that the contextual ribbon will occur.
Now that you have clicked the Standard Values button, there will automatically be created a subitem to the template called “__Standard Values”. This item is based on the template you created it from, and it is as such an actual item. You can change any field in this item, and then this will be the standard value for every item based on this template.
Tokens in Standard Values
It is possible to enter tokens in the fields on the standard values, and then these will be replaced with other values when the item is created. For instance, you can let the name of an item be filled into a title field. This is done by entering the token $name in the field:
By default there are the following tokens available in Sitecore:
- $name: The name of the item
- $id: The ID of the item
- $parentid: The ID of the parent of the item
- $parentname: The name of the parent of the item
- $date: The system date (yyyyMMdd)
- $time: The system time (HHmmss)
- $now: The date and time (yyyyMMddTHHmmss)
No comments:
Post a Comment