LibrarySites.Banner

Sitecore Idiosyncracies: Data Template for Data Templates

This blog post attempts to describe the data template for data template definition items in the Sitecore ASP.NET web Content Management System (CMS) and Experience Platform (XP).

Sitecore represents various types of data as items, which are like objects. The data template associated with each item defines the fields that make up that type of item, similar to a struct (but with additional features that can make it function more like a class). Sitecore uses items to define data templates. In addition to an item that contains standard values for the fields of the template, each data template definition item can contain section definition items, which in turn contain field definition items. In addition to any base templates from which the data template inherits, a definition item for a data template and the descendants of that definition item define the sections, fields, and standard values for items based on that data template. You can see this structure in the sample template.

editing a data template

The Builder tab that appears when you select a data template definition item in the Content Editor abstracts access to the most commonly used properties of the sections and fields that define the template. Specifically, Builder allows you to set the names of sections and fields, to specify the type and source for each field, and to specify whether to version or share the value of each field for all languages.

The /sitecore/templates/System/Templates/Template item defines the data template for data templates. The following Sitecore Rocks query confirms that this is the only item that is its own data template.

select @@path from //*[@@templateid=@@id]

Sitecore Rocks query for items based on themselves

The data template for data templates contains a single section named Data that contains a single tree list field named __Base template [sic] (Sitecore.FieldIDs.BaseTemplate [sic]) used to specify base templates for data templates. If a data template does not explicitly inherit from the null item, then it inherits from the standard template, which defines sections and fields common to all items.

The data template for data templates does not inherit from the standard template. Instead, its own __Base template field specifies the base templates from which the data template for data templates inherits. Because this selection includes only sections of the standard template, which each explicitly inherit from the null item, the data template for data templates does not inherit from the standard template. Instead, it inherits from the data templates in the standard template, excluding the Workflow section (and out of alphabetical order in CMS 8 150427).

Standard values for the data template for data templates specify the Template Builder and Inheritance editors, which expose the Builder and Inheritance tab when you select a data template definition item based on that data template. Standard values include insert options that allow users to create data template sections within data templates.

I can think of only one case in which one might modify the data template for data templates: to add a base template that contains fields common to all data templates, where that base template inherits from the null item.

If you have any additional information about the data template for data templates, please comment on this blog post.

Resources

  • I have a "base data template" which all other data templates inherit from, as you suggest above. I have added a new rendering into the __standardValues into this base template and saved it. when I now look at the child templates, the new rendering does not appear and I don't know why? any thoughts?   I've tried re-building the link database and several other things. If I add a new template and inherit this from the base the rendering appears correctly. What am I missing here?

  • @Liam: I suspect that the items override the standard values for layout details of the data template, apparently using explicit layout details rather than a layout delta.  If you view raw values for system fields, do you see a value for the __Renderings field in the Layout section of these items?  If you Presentation > Layout > Reset for one of these items, does the missing rendering then appear?

  • Currently recruiting for my organization for a Sitecore Migration Specialist/Developer role.  Would love to speak with anyone who might be interested.  This is a role where you would be an internal hire for my organization.  We are currently supporting NIH in Arlington VA.  I would love to elaborate on the role and the project.  Please contact me if you would be interested in a stable environment, tons of growth potential and a creativity driven environment.