
mFilter
Faceted filtering for MODX 3 with SEO URL support


Documentation for extending and customizing mFilter.
| Section | Description |
|---|---|
| JavaScript | Frontend architecture, script loading |
| JS API | Programmatic filter control |
| Headless API | REST API for SPA apps |
| Services | PHP services and Dependency Injection |
| Filter types | Custom filter types |
| Events | Plugin and system events |
| Models and DB | Database tables |
┌─────────────────────────────────────────────────────────┐
│ Frontend │
├─────────────────┬───────────────────────────────────────┤
│ SSR mode │ Headless mode │
│ (FilterUI) │ (ApiClient + FilterAPI) │
├─────────────────┴───────────────────────────────────────┤
│ Hooks System │
│ beforeApply → apply → afterApply │
├─────────────────────────────────────────────────────────┤
│ REST API Router │
├─────────────────────────────────────────────────────────┤
│ Controllers │
│ FilterController, SlugController │
├─────────────────────────────────────────────────────────┤
│ Services │
│ Filter │ FilterSet │ SlugManager │ UrlRouter │ SEO │
├─────────────────────────────────────────────────────────┤
│ Handlers │
│ FilterTypes │ Sources │ FilterHandler │
├─────────────────────────────────────────────────────────┤
│ Models │
│ FilterSet │ Slug │ Pattern │ WordForm │ SeoTemplate │
└─────────────────────────────────────────────────────────┘const filter = mfilterGet('mfilter-form');
filter.setFilter('brand', ['apple', 'samsung']);
filter.submit();mfilterHooks.add('beforeApply', (ctx) => {
console.log('Filters:', ctx.params.filters);
// You can modify ctx.params
});// In plugin on OnMFilterInit
$mfilter->getFilterTypeRegistry()->register('mytype', new MyFilterType($modx));// core/components/mfilter/config/services.php
return [
'slugManager' => MyCustomSlugManager::class,
];