Skip to main content

getFilterByMarker

Get a content filter and its tree of items by marker.

Description​

Fetches a content filter by its marker, localized to langCode. Resolves to an IContentFilter with the filter's localized info and its tree of items.

.getFilterByMarker(

,

);

Parameters schema​

Schema

marker(required): string
Marker of the filter.
example: "main"

langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"

Examples​

Minimal example​

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

Example with langCode​

const response = await Filters.getFilterByMarker('filter', '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 data of the filter in the requested locale.

items: IContentFilterItem[]
Tree of filter items: regular and custom items in one array.

items.type: TContentFilterItemType
Type of the node: the kind of entity it links to.
example: "page"

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

items.url: string | null
URL of the page for type: "page"; null for other types.
example: "about"

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

items.value: string | string[] | null
Unified node value: an array of values in range for a range attribute; for other attributes, the code of the selected list value or the stored value; the discount value for discount / personal-discount / bonus; the object id for product / admin / payment-method; the entered value for custom; null for a page.
example: ["25", "50", "75"]

items.position: number
Position of the node among its siblings at the same level.
example: 1

items.isVisible: boolean
Whether the node is shown. Returned for type=page nodes; absent for attribute/value nodes.
example: true

items.children: IContentFilterItem[]
Nested tree nodes; regular and custom items share one array.