Sitecore presentation details don't update on template change
Asked Answered
Q

3

5

I'm working on a Sitecore (6.4.0.101124) site that has two templates used for the home page. These have a very similar structure - the big difference between them is that they each have one different sublayout in the Controls section of the Presentation Details of the Standard Values. My understanding is that when the template is changed on an item the standard values of the template should be applied to that item. However, when the content editors change the template the presentation details remain the same until I go in and change them.

So this means that either I misunderstand how this is supposed to work, or something wonky is happening. This is a very similar problem to what's discussed in this thread, but the answers given don't seem to apply since this item was not created using a branch template.

Has anyone had a similar experience with this (and solved it)? Am I way off base in how this is supposed to work?

Quathlamba answered 1/10, 2012 at 20:52 Comment(1)
Why do content editors change the template? What do they get from it?Roxie
E
8

You write:

My understanding is that when the template is changed on an item the standard values of the template should be applied to that item.

This is only true if a field has not been edited. Once a field for an item has been edited, the edited value takes precedence over the default. Changing the template to one that has different Standard Values will only have an impact if the field has not been touched, or if the user resets the field to the default value using the Fields Reset button. (Note that manually clearing the field will not do the trick. Sitecore will store an empty string, which will override the Standard Value. By using the Reset button, you set the field to a Database Null, which causes the Standard Value to be used.)

Reset Button

You can tell if a field has been edited by checking for the text "standard value" next to the field in the Content Editor:

Standard Values display hint


Sitecore 6.4.0 and Layout Deltas

Things are more complex with the Renderings field on Sitecore 6.4.0 and above, because Sitecore introduced a feature called "Layout Deltas" with this release. Before Layout Deltas, if you edited the presentation details of an item, Sitecore would copy the layout information from the "Renderings" field of Standard Values into the item's Renderings field, which had the consequence that any subsequent change to Standard Values Renderings would have no effect on the display of this item.

This functionality made it difficult to manage changes to presentation, since a minor change to a detail of presentation on an individual item, such as adding conditional rendering logic, would break the inheritance from Standard Values. If if was necessary to change the presentation of a class of items, it was necessary to first change Standard Values, and then to make the same change to every item that modified presentation.

With Sitecore 6.4's Layout Deltas, if you modify the presentation of an item, just the change is stored in the item's Renderings field, rather than a complete copy of the Standard Values rendering. This change, or delta, information is applied on top of the Standard Values Renderings information, so that modifications to Standard Values layouts are applied to all inheriting items, not just ones with unmodified presentation.

It sounds like your content editors have made a modification to the presentation of the item. When the template is switched, this change is being applied on top of the new template. You can confirm this by checking for the [Standard Values] text next to the Renderings field of the item in question.

Earreach answered 4/10, 2012 at 4:43 Comment(1)
A very good introduction to Layout Deltas can be found here: sitecore.net/community/technical-blogs/getting-to-know-sitecore/…Earreach
B
3

The template has values, but what carries the values to the items that are created using that template is in the standard values item. Now, that being said, each field on an item that is created from that template has a flag that says whether or not its using template standard values. If the presentation details are NOT flagged as using standard values still, then its not going to cascade down the updates to the items.

Now.. to be sure that you understand the difference between a branch and a template.. a branch is sort of a "model" of how you can create an item. It is NOT going to cascade changes down when you make changes to the branch item at all. Items will inherit values from their TEMPLATE standard values. The branch values inherit only upon item creation.

EDIT: By the way, I should add that if you turn on the gutter on the left to show presentation overridden, you can see if the presentation values are standard values or not. If you see the icon, then you know the item is not currently using standard values.

Backler answered 2/10, 2012 at 0:22 Comment(3)
+1, but if you could include in your response the solution (how to reset) I think that would make it an even better answerChatelain
Sure. You reset it by either clicking the "reset" button in the ribbon next to the details button on the presentation tab. This resets presentation details for the item back to standard values. Alternatively, if you have the gutter showing presentation overridden, clicking the icon will also reset the item's presentation back to standard values.Backler
There are definitely standard values set for the presentation details. If I understand you correctly, what you're saying is that if the presentation details, or any other field for that matter, has been changed from the standard values that when the template is changed those fields won't change with it? I don't think it's really an option to have them reset the item to the standard values. I'll look into whether those fields have changed.Quathlamba
A
1

I got to this question because I had a field across hundreds of pages which I needed to change. It was not shared to begin with. I tried setting the field to Shared & Unversioned within the template but that did not cause it to change everywhere when I made changes.

I then proceeded to set a Standard Value in the template to what I wanted the field to be, and then selected Versions -> Fields -> Reset after highlighting the Standard Value. The first time I did this, it reset the field to blank. Then I did it again and the field changed on every page which used that particular field. Hope this helps. It seems if you already have a field which wasn't shared to begin with, you need to do a standard value reset to it.

Airel answered 13/6, 2013 at 20:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.