Macros in Widget Form, possible?

Senior Software Engineer - Kentico Xperience MVP

Trevor Fayas asked on August 23, 2016 15:54

Just curious if anyone has ever found a way to enable this, on Widget's configuration forms, there's no black > arrow to enter a widget instead. Sometimes it would be easier to use a default template and add in the different widgets instead of making a Page Template for each due to the need to configure the webpart/widget with a macro condition.

So anyone know how to do this, or no possibility to do so?

Recent Answers


Brenden Kehren answered on August 23, 2016 16:32

Macros are not available with widget properties on the front end. You can set them on the actual properties of the widget on the back end in the Widgets app. This would be my suggestion unless you want/need your content editor to put a macro in.

1 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on August 23, 2016 16:58

This is from K9 documentation - Adding macros into the default values of widget properties

Properties use the Default value when users create new instances of the widget. You can set dynamic default values through macro expressions.

The system resolves the macros according to the following rules:

If the property is available in the widget's configuration dialog (Display field in the editing form is checked), the macro resolves directly in the dialog when adding new instances of the widget.

If the property is NOT visible in the configuration dialog, the system dynamically resolves the macro when displaying the page containing the widget instance.

Adding an old example though valid for K9 too - http://blogs.jeroenfurst.nl/blog/november-2010/tips-and-tricks-macros-in-widgets

2 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 23, 2016 17:59

As i thought, you can set macro default values, but not allow macros to be set in the widget configuration itself. Just seeing if i missed anything! May have to create a custom form control to allow it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.