CQ5.3: How to define component list dynamically for Sidekick and Insert dialog

Problem

The way components are listed in the sidekick is not always satisfying and so it would be nice to have control on it.

Resolution

Since 5.3 the list of allowed components is computed only on the client.

Each client side component also gets a cell search path and eventually a CQ.wcm.Cell assigned.
The array of allowed components is kept in a CQ.wcm.ComponentList class of which there is an instance per page.
The insert dialogs and the sidekick get the final list of component from that object.
Before the component list object is updated with the list of allowed components of the editable, it fires an "updatecomponentlist" event, which can be used to intercept and modify the list dynamically.
The "updatecomponentlist" listener can be registered using the normal editConfig listeners on the container component (eg. parsys):

/** 
 * Is called before the {CQ.wcm.ComponentList} is updated. 
 * @param this {CQ.wcm.EditBase} this editable 
 * @param cell {CQ.wcm.Cell} the cell of this editable 
 * @param allowed {Array} the preliminary list of allowed components 
 * @param componentList {CQ.wcm.ComponentList} the component list object that will receive the list 
 */ 
function MyHandler(cell, allowed, componentList) { 
   // manipulate the 'allowed' array if needed 
} 

Please note that "runtime" manipulations of the component list is currently not supported. i.e. if the list of allowed components depends on client side changes, this can't be propagated to the dialogs.

Applies to

CQ 5.3

 Adobe

Få hjælp hurtigere og nemmere

Ny bruger?

Adobe MAX 2024

Adobe MAX
kreativitetskonferencen

14-16. oktober i Miami Beach og online

Adobe MAX

Kreativitetskonferencen

14-16. oktober i Miami Beach og online

Adobe MAX 2024

Adobe MAX
kreativitetskonferencen

14-16. oktober i Miami Beach og online

Adobe MAX

Kreativitetskonferencen

14-16. oktober i Miami Beach og online