You can extend widget models to modify widgets implementation.
The following example demonstrates how to extend the model of the Navigation widget and thus modify the widget's display settings. You first implement a custom model that represents page nodes with descriptions and then modify the widget's view to use the new model.
First, in the Mvc/Models/Navigation folder you create a new view model that represents a page node. The model inherits from the default model, so it is usable. Add an extra Description property to the model:
Mvc/Models/Navigation
Description
As a result, the new model extracts page descriptions.
Next, you create a new model that is aware of the custom view model. The new navigation model inherits from the default model and exposes the same constructors. You then override the InstantiateNodeViewModel method and its overloads in the new model:
InstantiateNodeViewModel
You use the NavigationView.Tabs view as a starting point. Wherever page nodes are enumerated, make sure to specify the new view model class and print the node's Description:
NavigationView.Tabs
You finally replace the original implementation of the Navigation widget model with the new model. You do this using Bootstrapper.Bootstrapped event. Place the following code in your Global.asax file:
Bootstrapper.Bootstrapped
Global.asax
IBlogModel
BlogModel
IBlogPostModel
BlogPostModel
ICardModel
CardModel
ICommentsModel
CommentsModel
IContentBlockModel
ContentBlockModel
IDynamicContentModel
DynamicContentModel
ISubscribeFormModel
SubscribeFormModel
IUnsubscribeFormModel
UnsubscribeFormModel
IEventModel
EventModel
IEventSchedulerModel
EventSchedulerModel
IFormModel:
ICaptchaModel
ICheckboxesFieldModel
IDropdownListFieldModel
IFileFieldModel
IHiddenFieldModel
IMultipleChoiceFieldModel
INavigationFieldModel
IPageBreakModel
IParagraphTextFieldModel
ISectionHeaderModel
ISubmitButtonModel
ITextFieldModel
IFormFieldModel
FormModel:
CaptchaModel
CheckboxesFieldModel
DropdownListFieldModel
FileFieldModel
HiddenFieldModel
MultipleChoiceFieldModel
NavigationFieldModel
PageBreakModel
ParagraphTextFieldModel
SectionHeaderModel
SubmitButtonModel
TextFieldModel
FormFieldModel
IAccountActivationModel
AccountActivationModel
IChangePasswordModel
ChangePasswordModel
ILoginFormModel
LoginFormModel
ILoginStatusModel
LoginStatusModel
IProfileModel
ProfileModel
IRegistrationModel
RegistrationModel
IUsersListModel
UsersListModel
IEmbedCodeModel
IJavaScriptModel
JavaScriptModel
IStyleSheetModel
StyleSheetModel
IListsModel
ListsModel
IDocumentModel
DocumentModel
IDocumentsListModel
DocumentsListModel
IImageModel
ImageModel
IImageGalleryModel
ImageGalleryModel
IVideoModel
VideoModel
IVideoGalleryModel
VideoGalleryModel
INavigationModel
NavigationModel
INewsModel
NewsModel
IFeedModel
FeedModel
ISearchBoxModel
SearchBoxModel
ISocialShareModel
SocialShareModel
IFlatTaxonomyModel
FlatTaxonomyModel
IHierarchicalTaxonomyModel
HierarchicalTaxonomyModel
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important