| Hook | actionFacetedSearchSetSupportedControllers |
|---|---|
| Locations | FO |
| Type | action |
| Origin | ps_facetedsearch |
| Aliases | |
| Description | This hook allows modules to declare additional controllers that should support Faceted Search filters. These controllers will appear in the module configuration template as eligible for displaying faceted filters. |
| Origin | File |
|---|---|
| core | ps_facetedsearch.php |
The actionFacetedSearchSetSupportedControllers hook allows third-party modules to append custom controllers to the list of controllers supported by the ps_facetedsearch module.
This makes it possible to enable faceted filters on non-standard pages, such as custom product listings, landing pages or other bespoke front controllers.
The hook receives an array of parameters:
| Parameter | Type | Description |
|---|---|---|
| supportedControllers | array | Associative array of supported controllers, passed by reference. |
The supportedControllers array is passed by reference, so you can modify it directly. The structure follows the one used internally by the module, for example:
[
'category' => [
'name' => 'Category',
'cacheable' => true,
],
'manufacturer' => [
'name' => 'Brand',
'cacheable' => true,
],
// ...
];
public function hookActionFacetedSearchSetSupportedControllers(array $params): void
{
// Add a custom front controller that should support Faceted Search filters
$params['supportedControllers']['mycustomproductlisting'] = [
'name' => $this->trans('Custom product listing', [], 'Modules.Custommodule.Front'),
'cacheable' => true,
];
}
Hook::exec(
'actionFacetedSearchSetSupportedControllers',
[
'supportedControllers' => &$supportedControllers,
]
);