Documentation

Custom portlet view model

The view model is an object available in every template. It is a simple object with properties that describe the current state of the page running the template.

Properties


BestMatchingCulture

Syntax:

public string BestMatchingCulture { get; set; }

Return value:

Type Description
string The culture that the page is currently running under

Examples:

@this.Model.BestMatchingCulture

CustomPortletId

Syntax:

public int CustomPortletId { get; set; }

Return value:

Type Description
int The id of the custom portlet

Examples:

@this.Model.CustomPortletId

ContentId

Syntax:

public int ContentId { get; set; }

Return value:

Type Description
int The content id of the page the portlet is executing on

Examples:

@this.Model.ContentId

Configuration

Syntax:

public string Configuration { get; set; }

Return value:

Type Description
string The content id of the page the portlet is executing on

Examples:

@this.Model.Configuration 

CurrentPage

Syntax:

public IPage CurrentPage { get; set; }

Return value:

Type Description
IPage An instance of the page the the portlet is currently executing on

Examples:

@this.Model.CurrentPage


CurrentUser

Syntax:

public IUser BestMatchingCulture { get; set; }

Return value:

Type Description
IUser The instance of the current user

Examples:

@this.Model.CurrentUser


CurrentUserCanEditThisContent

Syntax:

public bool CurrentUserCanEditThisContent { get; set; }

Return value:

Type Description
bool True if the user can edit the page the portlet is running on. False otherwise

Examples:

@this.Model.CurrentUserCanEditThisContent


CurrentContentIsCurrentUsersPlace

Syntax:

public bool CurrentContentIsCurrentUsersPlace{ get; set; }

Return value:

Type Description
bool True if this page is the current user's profile page. False otherwise

Examples:

@this.Model.CurrentContentIsCurrentUsersPlace



Methods


GetConfiguration

Syntax:

public Dictionary<string, object> GetConfiguration()

Return value:

Type Description
Dictionary<string, object>
The configuration json string as a dictionary

Examples:

@{
    var configuration = this.Model.GetConfiguration();
}