Home > widget-integration > FilterModule > connectWidget
FilterModule.connectWidget() method
Connects a FilterController widget with an AppBlock configuration.
Extracts filter-specific properties from the block and passes them to the widget's connect method. This establishes the widget's initial state and configuration.
Signature:
protected connectWidget(widget: FilterController, block: AppBlock): Promise<void>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
widget |
The FilterController instance to connect | |
|
block |
The AppBlock containing filter configuration data |
Returns:
Promise<void>
Remarks
The block is cast to access filter-specific properties (filterTree, cache, etc.) that are not part of the base AppBlock type. Override this method to customize which properties are passed to the widget or to add shop-specific configuration.
Example
Override to add custom widget configuration:
protected async connectWidget(
widget: FilterController,
block: AppBlock
): Promise<void> {
await super.connectWidget(widget, block);
// Add custom post-connection logic
widget.setCustomSettings(this.getShopSettings());
}