Kentico 12 sections "allowed widgets"

Craig Barben asked on January 17, 2019 23:26

  • Version: 12
  • Hotfix: None
  • Dev model: MVC

Hi, I am attempting to limit the allowed widgets in a section. The sections render the editable region slightly differently according to the documentation and my attempts.

When rendering a editable region, there is an optional third parameter for specifying the allowed widgets in that zone. This is not the case for sections.

This is the helper used to render the editable area from a template file:

@Html.Kentico().EditableArea("areaWithSection", null, new string[] { "widgets.externallinkpanel" })

This is the helper to render the widget zone from within a section:

@Html.Kentico().WidgetZone()

I haven't been able to find any documentation defining how to limit the widgets in a zone. I don't think the @Html.Kentico.EditableArea() helper can be used from within the section.

Is this something that can be accomplished?

Thanks in advance.

Recent Answers


Dawid Jachnik answered on January 18, 2019 08:46

Hello, By design is not achievable, you can't limit the number of widgets in widget zone.

But probably you could do it with javascript, when after reaching limit you could hide the "Add new widget" button

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on January 18, 2019 09:22

If I understand correctly you want to limit the type of widgets differently for each section? But you can only limit it per area..

kentico sample EditableAreas

The problem with that is that there is also logic from within Kentico. You can change a section-type. Say you change section 2 to Section 1 (meaning lose 1 zone) from the image above. Kentico automatically moves widgets to the next available zone.

Also the "allowed widgets" is to be used as a guide and not a limitation. If the widget was placed it won't be removed when you change the allowed widgets param.

0 votesVote for this answer Mark as a Correct answer

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