Changing default attributes of webparts
This article describes how to change a default attribute in a webpart, such as DisplayToRoles.
Attributes, that can be changed, are
WebPartControlID,
WebPartTitle,
DisableViewState,
DisableMacros,
Visible,
HideOnSubPages,
ShowForDocumentTypes and
DisplayToRoles.
You can change the mentioned values in the file
Webpart_PropertiesBefore.xml located in
~\CMSModules\PortalEngine\UI\WebParts\Properties\Basic\:
For example:
<field column="DisplayToRoles" fieldcaption="Display to roles" visible="true" columntype="text" fieldtype="usercontrol" allowempty="true" isPK="false" system="false" columnsize="250" fielddescription="{$documentation.webpartproperties.displaytoroles$}" publicfield="false" spellcheck="true" guid="190c38c7-904b-4044-bc78-6998b50ae31a">
After changing this value, every new webpart will have a new default value for this property.
If you want to override this setting in existing webparts, you can simply create a new attribute with the same code name e.g.
DisplayToRoles and set it to the same
Attribute type (Text), same
field type (Role selector) and change the property, which you need to change (e.g. Attribute size).
Please don't forget to check the box Allow empty value.
-bp-
See also: Setting web part properties dynamically in your codeApplies to: Kentico CMS 5.5