Page types and templates

Templates for sites or display templates for products can be pointed to an ASP.NET MVC controller instead of a ASP.NET WebForms aspx-file.

Attributes

PagePropertiesAttribute

The Litium.Web.Mvc.PagePropertiesAttribute is used on a controller action to define which properties should be avaliable in the editor when a template is connected to the action.

By using the attribute properties can be made visible to an editor per template instead of on all the pagetypes templates (using the "Show in edit mode"-setting for the property on the pagetype).

The attribute has overloads that either take a type that inherits from Litium.Studio.Builders.CMS.PageTypeDefinition (which then maps to all the types properties) or a string array with property names.

PageTemplateAttribute

The Litium.Web.Mvc.PageTemplateAttribute is used to define a pagetype template and connect it to a pagetype using code first.

Example action method decorated with both PagePropertiesAttribute and PageTemplateAttribute:

[HttpGet]
[PageProperties(typeof(News))]
[PageTemplate(typeof(News), "~/Site/Images/News.png", Name = "News1")]
public ActionResult Index([NotNull] News currentPageDefinition)

 

 

 

Is this page helpful?
Thank you for your feedback!