Kentico 12 - MVC widget properties

David te Kloese

Next month Kentico EMS 12 will be released and we are right in the middle of the #RaptorWorldTour2018. For the newest version Kentico invested heavily in MVC. Part of that was out of the box support for Widgets. Giving editors the freedom they liked from Portal engine. The latest edition to this feature is support for a properties pop-up window.

Note: This post describes features available in the unfinished version of Kentico 12 as part of Beta release. all features are subject to change and are in no way guaranteed to be in the final version.

So what's the big deal?

What I personally liked most about Widgets was the flexibility for the editors in combination with the ability for Developers to limit and extend every part of it. In Kentico MVC development there was no similar out of the box solution. Custom development made it possible to mimic widget-like behavior. With extra instructions editors could manage, but to me it never felt as intuitive or flexible as in the Portal Engine Widgets.

Show me

As you can see in the capture below. In the new Forms Builder you'll be able to add widgets to predefined zones. Next to inline options, for text or images, you'll now have to ability to add extra configuration options for the editor which are not directly visible.

For the developer

So what do you as a developer have to do to support this type of properties? Turns out, not that much.

To enable the inline editor properties you'll render a Partial View in the View of your Widget. Only launched when you're currently in Edit Mode.
To enable the properties window you'll just have to decorate the different properties in the  PropertiesModel with a EditingComponent attribute.
The most important parameter is the Type defining the control used for the editing. There are also a number of additional configurations possible.
There are a number of default component types available, but you'll be able to develop your own. Out of the box you'll have types like:
  • Checkbox
  • Drop-down list
  • Numeric input
  • Radio buttons
  • Text input

But also specific component types like
  • Email
  • U.S. phone number
  • Consent agreement

Check out the following posts for some more info about the setup of MVC Widgets from previous beta's:

But wait there is more

You are not limited to just picking inline or properties as configuration option. You can have both! Say I'd like the button text to also be available in the properties window. By adding the following attribute it just works:

Widget Add Editing Component code

Let me play

Can't wait for the Kentico 12 release and also want to try out the Kentico 12 beta 3? Although not publicly available you can email [email protected] to request your own copy.