Skip to main content

getSlides

Get the slides of a slider block as a flat list.

Description​

Fetches the slides of a slider_block block and resolves to an IBlockSlidesResponse. The slides come as a flat array in pre-order; each item has a depth and a parentId, so you can rebuild the tree on the client. Only visible slides are returned: a hidden slide and its children are left out, so visible is always true and total counts visible slides. The method takes no langCode; attributeValues come in the language set in defineOneEntry.

.getSlides(

);

Parameters schema​

Schema

marker(required): string
Marker of the block.
example: "slider_block"

Examples​

Minimal example​

const response = await Blocks.getSlides('slider_block');

Example response​

{
"total": 1,
"items": [
{
"id": 1,
"parentId": null,
"depth": 0,
"position": 1,
"visible": true,
"attributeValues": {}
}
],
"time": 3,
"timeInterval": "sec"
}

Response schema​

Schema: IBlockSlidesResponse

total: number
Number of visible slides in the tree.
example: 3

time: number
Default time each slide is shown, in timeInterval units. Absent when the block has no slider time set.
example: 5

timeInterval: 'sec' | 'ms'
Unit of time: "sec" or "ms".
example: "sec"

items: IBlockSlideItem[]
Slide items as a flat array in pre-order.

items.id: number
Slide ID.
example: 1

items.parentId: number | null
ID of the parent slide, or null for root slides.
example: null

items.depth: number
Depth of the slide in the tree.
example: 0

items.position: number
Position of the slide among its siblings.
example: 1

items.visible: boolean
Always true: hidden slides are not returned.
example: true

items.time: number
How long the slide is shown, in timeInterval units. Absent when not set.
example: 5

items.timeInterval: 'sec' | 'ms'
Unit of time: "sec" or "ms".
example: "sec"

items.attributeValues: IAttributeValues
Map of attribute values keyed by marker.