| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
$bppiv_block = call_user_func( function() use ( $get_value, $bppiv_meta, $bppiv_width, $bppiv_height ) { |
| 7 |
return [ |
| 8 |
"blockName" => "panorama/image-360", |
| 9 |
"attrs" => [ |
| 10 |
"imageUrl" => $bppiv_meta['image_src_360'] ?? '', |
| 11 |
"panoramaFormat" => $bppiv_meta['panorama_format_360'] ?? 'equirectangular', |
| 12 |
"haov" => (float) ($bppiv_meta['haov_360'] ?? 360), |
| 13 |
"vaov" => (float) ($bppiv_meta['vaov_360'] ?? 180), |
| 14 |
"vOffset" => (float) ($bppiv_meta['voffset_360'] ?? 0), |
| 15 |
"cubeMap" => [ |
| 16 |
"front" => $bppiv_meta['cubemap_front_360'] ?? '', |
| 17 |
"right" => $bppiv_meta['cubemap_right_360'] ?? '', |
| 18 |
"back" => $bppiv_meta['cubemap_back_360'] ?? '', |
| 19 |
"left" => $bppiv_meta['cubemap_left_360'] ?? '', |
| 20 |
"up" => $bppiv_meta['cubemap_up_360'] ?? '', |
| 21 |
"down" => $bppiv_meta['cubemap_down_360'] ?? '', |
| 22 |
], |
| 23 |
"previewImgUrl" => $bppiv_meta['previewImgUrl'] ?? '', |
| 24 |
"loadButtonText" => $bppiv_meta['loadButtonText'] ?? 'Click to Load Panorama', |
| 25 |
"options" => [ |
| 26 |
"isRotate" => $get_value('bppiv_auto_rotate', true, true), |
| 27 |
"autoRotateSpeed" => $bppiv_meta['bppiv_speed'] ?? 1, |
| 28 |
"autoRotateInactivityDelay" => $bppiv_meta['auto_rotate_inactivity_delay'] ?? 3000, |
| 29 |
"hideDefaultCtrl" => $get_value('control_show_hide', true), |
| 30 |
"initialView" => $get_value('initial_view', true), |
| 31 |
"initialViewPosition" => [ |
| 32 |
"pitch" => (float)$get_value('initial_view_property', false, 0, 'top'), |
| 33 |
"yaw" => (float)$get_value('initial_view_property', false, 0, 'right'), |
| 34 |
"hfov" => (float)$get_value('initial_view_property', false, 0, 'bottom') |
| 35 |
], |
| 36 |
"autoLoad" => $get_value('bppiv_auto_load', true, true), |
| 37 |
"draggable" => $get_value('draggable_360', true, true), |
| 38 |
"compass" => $get_value('compass_360', true), |
| 39 |
"orientation" => $get_value('orientation_360', true), |
| 40 |
"titleAuthor" => $get_value('title_author', true, true), |
| 41 |
"title" => $bppiv_meta['title_360'] ?? '' , |
| 42 |
"author" => $bppiv_meta['author_360'] ?? '', |
| 43 |
"mouseZoom" => $get_value('mouse_zoom', true, true) , |
| 44 |
"disableKeyboardCtrl" => $get_value('disable_keyboard_ctrl', true) , |
| 45 |
"doubleClickZoom" => $get_value('double_click_zoom', true, true) , |
| 46 |
"isByline" => $get_value('showByPrefix', true, true), |
| 47 |
], |
| 48 |
"customControl" => $get_value('custom_control', true) , |
| 49 |
"layout" => [ |
| 50 |
"alignSl" => [ |
| 51 |
"desktop" =>$bppiv_meta['bppiv_alignment'] ?? "center", |
| 52 |
"tablet" => $bppiv_meta['bppiv_alignment'] ?? "center", |
| 53 |
"mobile" => $bppiv_meta['bppiv_alignment'] ?? "center" |
| 54 |
], |
| 55 |
"width" => [ |
| 56 |
"desktop" => $bppiv_width, |
| 57 |
"tablet" => $bppiv_width, |
| 58 |
"mobile" => $bppiv_width |
| 59 |
], |
| 60 |
"height" => [ |
| 61 |
"desktop" => $bppiv_height, |
| 62 |
"tablet" => $bppiv_height, |
| 63 |
"mobile" => $bppiv_height |
| 64 |
] |
| 65 |
] |
| 66 |
], |
| 67 |
"innerBlocks" => [], |
| 68 |
"innerHTML" => "", |
| 69 |
"innerContent" => [] |
| 70 |
]; |
| 71 |
} ); |