Skip to main content

getFilterByMarker

Get a filter by its marker (tree of items).

Description

This method retrieves a single content filter by its marker, localized to the requested language. It returns a Promise that resolves to an IContentFilter object containing the filter's localized info and its items tree.

Filters.getFilterByMarker(

marker*, langCode

);

Parameters schema

Schema

marker(required): string
Filter marker
example: "main"

langCode: string
Language code. Default: "en_US"
example: "en_US"

Examples

Minimal example

const response = await Filters.getFilterByMarker('main');

Example with attributes

const response = await Filters.getFilterByMarker('main', 'en_US');

Example response

{
"localizeInfos": {
"title": "Filter"
},
"items": [
{
"type": "page",
"marker": null,
"url": "blog",
"localizeInfos": {
"title": "Blog",
"menuTitle": "Blog"
},
"value": null,
"position": 1,
"children": []
},
{
"type": "page",
"marker": null,
"url": "blog1",
"localizeInfos": {
"title": "Blog 1",
"menuTitle": "Blog 1"
},
"value": null,
"position": 2,
"children": []
},
{
"type": "page",
"marker": null,
"url": "catalog",
"localizeInfos": {
"title": "Catalog",
"menuTitle": "Catalog"
},
"value": null,
"position": 3,
"children": []
},
"..."
]
}

Response schema

Schema: IContentFilter

localizeInfos: ILocalizeInfo
Localized info of the filter in the requested locale.

items: IContentFilterItem[]
Filter items tree (regular items + custom items in a single array).

items.type: TContentFilterItemType
Tree node type.
example: "page"

items.marker: string | null
Marker of the linked entity, or null for type=page.
example: "about"

items.url: string | null
Page URL (only for type=page; null otherwise).
example: "about"

items.localizeInfos: ILocalizeInfo
Localized info of the linked entity in the requested locale.

items.value: string | null
Unified node value (e.g. discount value, attribute title); null otherwise.
example: "10"

items.position: number
Numeric position (per-level).
example: 1

items.children: IContentFilterItem[]
Nested tree nodes (regular and custom items in a single array).