Setting portlet preferences for portlet entities | HCL Digital Experience

You can set the portlet preferences for portlet entities.

About this task

To set the portlet preferences for a portlet entity, proceed by the following steps:

Procedure

  1. Obtain a modifiable instance of a portlet entity.
  2. Obtain the modifiable portlet preferences layer.
  3. Set the preferences by using the appropriate methods of the ModifiablePortletPreferences interface.

Example

Example - Setting portlet preferences on a portlet entity:
// obtain portlet model controller
final PortletModelController pmController = getPortletModelController(portletModel);
        
// obtain modifiable instance of a portlet entity
final Modifiable modifiable = pmController.getModifiableNode(portletEntity);

// obtain modifiable preferences layer
final ModifiablePortletPreferences preferences = ((ModifiablePortletEntity) 
    modifiable).getModifiablePortletPreferencesLayer();

// set a single value
preferences.setStringValue("name", "value");