internal
static
ContentViewControlElement DefineLocationsFrontendContentView(ConfigElement parent)
{
// define content view control
var controlDefinition =
new
ContentViewControlElement(parent)
{
ControlDefinitionName = LocationsDefinitions.FrontendDefinitionName,
ContentType =
typeof
(LocationItem),
UseWorkflow =
false
};
// *** define views ***
#region Locations List View
// define element
var locationsListView =
new
ContentViewMasterElement(controlDefinition.ViewsConfig)
{
ViewName = LocationsDefinitions.FrontendListViewName,
ViewType =
typeof
(MasterListView),
AllowPaging =
true
,
DisplayMode = FieldDisplayMode.Read,
ItemsPerPage = 4,
FilterExpression = DefinitionsHelper.NotPublishedDraftsFilterExpression,
SortExpression =
"Title ASC"
,
UseWorkflow =
false
};
// add to content view
controlDefinition.ViewsConfig.Add(locationsListView);
#endregion
#region Locations Details View
// Initialize View
var locationsDetailsView =
new
ContentViewDetailElement(controlDefinition.ViewsConfig)
{
ViewName = LocationsDefinitions.FrontendDetailViewName,
ViewType =
typeof
(DetailsView),
ShowSections =
false
,
DisplayMode = FieldDisplayMode.Read
};
// add to ContentView
controlDefinition.ViewsConfig.Add(locationsDetailsView);
#endregion
// return content view control
return
controlDefinition;
}