Previous Lecture Complete and continue  

  Rendering Parameters

Rendering Parameters are values that are directly associate to a specific rendering and can be used to control how a rendering appears. For more information on creating rendering parameters see Dylan Young's YouTube video.

Rendering Parameters are not stored as regular Sitecore items but are instead stored in the rendering layout XML of the item containing the specific rendering. Due to this fact Rendering Parameters do not behave in the same manner as regular item fields.

Rendering Parameters are defined using a standard Sitecore template which allows you to use most of the out of the box Sitecore fields. Glass.Mapper.Sc is the only framework that allows you to convert Rendering Parameters into a strongly typed model.

The Model

When creating your Glass.Mapper.Sc model to work with Rendering Parameters you must define the Sitecore Template ID that the model will work with.

Once the model has been defined then you can use the GetRenderingParameters method on the IGlassHtml interface to map the data to the model:

Rendering Parameter models do not support the full range of Glass.Mapper.Sc mapping. The following mapping type are supported:

  • Field
  • Node
  • Query

There are also several other restrictions when using rendering parameters that you need to be aware of:

  1. You can not use the Editable, RenderLink or RenderImage methods to make Rendering Parameter values editable because Sitecore does not support this. You can still use RenderLink and RenderImage to render the contents to screen.
  2. Rendering Parameters are read only you can't use Glass.Mapper.Sc to save Rendering Parameters.