Table of Contents

Class RegisterWidgetAttribute

Namespace
Kentico.PageBuilder.Web.Mvc
Assembly
Kentico.Content.Web.Mvc.dll

Registers a widget definition to be used within Page builder feature.

public sealed class RegisterWidgetAttribute : RegisterComponentAttribute, IPreInitAttribute
Inheritance
object
Attribute
RegisterWidgetAttribute
Implements
Inherited Members
Extension Methods

Constructors

RegisterWidgetAttribute(string, string, Type, string)

Registers a simple page builder widget using a view.

public RegisterWidgetAttribute(string identifier, string name, Type propertiesType = null, string customViewName = null)

Parameters

identifier string

Unique identifier of the widget definition.

name string

Name of the registered widget.

propertiesType Type

Type of the registered widget properties model. The type needs to implement the IWidgetProperties interface.

customViewName string

Custom view name for the registered widget. If not specified, the default system view name in format '~/Shared/Widgets/_{identifier}' is used.

Remarks

Make sure to provide unique identifier for the widget definition from the start. This identifier is used within the page configuration of widgets and any further change can lead to incorrect configuration load. Consider specifying identifier in format 'CompanyName_ModuleName_WidgetName', e.g. 'Kentico_Content_ArticlesListWidget'.

Use this attribute when simple widget is being developed and no custom controller is needed.

RegisterWidgetAttribute(string, Type, string, Type)

Registers a simple page builder widget using a view component.

public RegisterWidgetAttribute(string identifier, Type viewComponentType, string name, Type propertiesType = null)

Parameters

identifier string

Unique identifier of the widget definition.

viewComponentType Type

Custom view component type for the registered widget.

name string

Name of the registered widget.

propertiesType Type

Type of the registered widget properties model. The type needs to implement the IWidgetProperties interface.

Remarks

Make sure to provide unique identifier for the widget definition from the start. This identifier is used within the page configuration and any further change can lead to incorrect configuration load. Consider specifying identifier in format 'CompanyName_ModuleName_WidgetName', e.g. 'Kentico_Content_ArticlesListWidget'.

Use this attribute when simple widget is being developed and no custom controller is needed.

Properties

AllowCache

A flag indicating whether the output of the widget can be cached.

public bool AllowCache { get; set; }

Property Value

bool
See Also

Methods

PreInit()

Registers the widget definition during application pre-initialization.

public override void PreInit()