render with unique ids
This commit is contained in:
parent
d25de5493e
commit
414217e069
|
@ -70,14 +70,12 @@ class PanoramaViewer extends AbstractBlockLayout
|
||||||
}
|
}
|
||||||
|
|
||||||
$urls = [];
|
$urls = [];
|
||||||
$pannellum_ids = [];
|
static $id = 0;
|
||||||
$id = 1;
|
|
||||||
foreach ($attachments as $attachment)
|
foreach ($attachments as $attachment)
|
||||||
{
|
{
|
||||||
foreach($attachment->item()->media() as $media)
|
foreach($attachment->item()->media() as $media)
|
||||||
{
|
{
|
||||||
$id = $id +1;
|
|
||||||
array_push($pannellum_ids, "pv-{$id}");
|
|
||||||
$mediaType = $media->mediaType();
|
$mediaType = $media->mediaType();
|
||||||
$mediaRenderer = $media->renderer();
|
$mediaRenderer = $media->renderer();
|
||||||
if (strpos($mediaType, 'image/') !== false) {
|
if (strpos($mediaType, 'image/') !== false) {
|
||||||
|
@ -91,7 +89,7 @@ class PanoramaViewer extends AbstractBlockLayout
|
||||||
'title' => $block->dataValue('title'),
|
'title' => $block->dataValue('title'),
|
||||||
'height' => $block->dataValue('height'),
|
'height' => $block->dataValue('height'),
|
||||||
'urls' => $urls,
|
'urls' => $urls,
|
||||||
'pannellum_ids' => $pannellum_ids,
|
'id' => 'pv-' . ++$id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,12 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="pannellum">
|
<div class="pannellum">
|
||||||
<div id="<?= $pannellum_ids[0] ?>" class="panorama-viewer"></div>
|
<div id="<?= $id ?>" class="panorama-viewer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
pannellum.viewer("<?= $pannellum_ids[0] ?>", {
|
pannellum.viewer("<?= $id ?>", {
|
||||||
type: "<?= $panorama_type ?>",
|
type: "<?= $panorama_type ?>",
|
||||||
autoLoad: true,
|
autoLoad: true,
|
||||||
panorama: "<?= $urls[0]; ?>",
|
panorama: "<?= $urls[0]; ?>",
|
||||||
|
|
Loading…
Reference in New Issue