Monday 2 December 2013

Sitecore Parameters Template Field

As we move into using the DMS more and more often we are also starting to use the page editor more and more often. This leads to a need for making the way we insert sub-layouts/renderings easier for our users and it turns out Sitecore has made a start on this already by giving us small features that can make a big difference, in this case the "Parameters Template" field.

When you add a presentation component to a page in Sitecore you have the option of editing its component properties and this it what it looks like by default:



And if you wanted to customise the data being passed to this instance of the sub-layout(beyond the data source) you would need to add additional properties as key value pairs to the "Parameters" section. In my mind this is fraught with danger, it is free text and there is no guarantees around the names or types of values being passed to your control.
This is where the "Parameters Template" field comes into play. If you take a look at any of your sub-layout or renderings items you will notice there is a field called "Parameters Template"
By setting this field you are giving Sitecore a prompt on how to ask for the values when editing the "Component Properties" and allows you to name and type the values. 

All you need to do is create a template that inherits from the "Standard Rendering Parameters" template: create the fields you want and set the "Parameters Template" field to point to it.


And "Hey Presto!!", when you edit the component properties of the sub-layout you get the fields, named and typed. Therefore removing the possibility of typos and making the editing process that much nicer.


Now I should probably mention that this doesn't change anything form a code point of view in as much as these values all still come in via the parameters collection that you have without this field, its just making the editing process nicer.

How to disable "Add Users" in Sitecore's Platform DXP

 I have seen a few posts going around the community asking how to disable the "Add Users" button in Sitecore Platform DXP.   This ...