# panorama/trunk/blocks/gallery.php

Panorama – Turn Photos into Immersive Virtual Tours, version trunk. 50 lines.

- Page: https://pluginprobe.com/plugins/panorama/trunk/code/blocks/gallery.php
- Raw: https://pluginprobe.com/plugins/panorama/trunk/raw/blocks/gallery.php
- Modified: 2026-09-09T06:14:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/panorama/trunk/code/blocks/gallery.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$bppiv_block = call_user_func( function() use ( $get_value, $bppiv_meta ) {
    $galleries = $get_value('bppiv_pan_gallery', false, [] );

    $items  = [];

    foreach ($galleries as $key => $gallery) {
        $items[] = [
            "img" => $gallery['panoramic_img']['url'],
            "isSetVideo" => (bool) $gallery['gal_type_cheek'],
            "video" => $gallery['gal_type_video']['url'],
            "fov" => isset($gallery['fov']) ? $gallery['fov'] : 85,
            "initialPosition" => isset($gallery['initial_view_pos']) ? [
                "x" => $gallery['initial_view_pos']['top'],
                "y" => $gallery['initial_view_pos']['right'],
                "z" => $gallery['initial_view_pos']['bottom']
            ] : null,
            "initialView" => isset($gallery['gallery_initial_view']) ? (bool)$gallery['gallery_initial_view'] : false
        ];
    }

    return [
        "blockName" => "panorama/gallery",
        "attrs" =>  [
            "galleries" => $items,
            "galleryLimit" => (int)$get_value('bppiv_gallery_limit', false),
            "column" => $get_value('bppiv_gallery_column', false),
            "gap" => $get_value('bppiv_gallery_column_gap', false, 'width'),
            "gap" =>  $bppiv_meta['bppiv_gallery_column_gap']['width'] . 'px' ,
            "loadMoreBtn" => [
                "text" => $get_value('loadMore_btn_text', false),
                "colors" => [
                    "color" => $get_value('loadMore_text_color', false),
                     "bg" => $get_value('loadMore_btn_bg', false),
                ],
                "hoverColors" => [
                    "color" => $get_value('loadMore_text_hover_color', false),
                     "bg" => $get_value('loadMore_hover_bg', false),
                ]
            ]
        ],
        "innerBlocks" => [],
        "innerHTML" => "",
        "innerContent" => []
    ];
} );
```
