From 414217e069beba8516d67697289afac192ea6f3e Mon Sep 17 00:00:00 2001 From: buttle Date: Sat, 3 Apr 2021 18:56:54 +0200 Subject: [PATCH] render with unique ids --- src/Site/BlockLayout/PanoramaViewer.php | 8 +++----- view/common/block-layout/panorama-viewer.phtml | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Site/BlockLayout/PanoramaViewer.php b/src/Site/BlockLayout/PanoramaViewer.php index a2499c8..414a39f 100644 --- a/src/Site/BlockLayout/PanoramaViewer.php +++ b/src/Site/BlockLayout/PanoramaViewer.php @@ -70,14 +70,12 @@ class PanoramaViewer extends AbstractBlockLayout } $urls = []; - $pannellum_ids = []; - $id = 1; + static $id = 0; + foreach ($attachments as $attachment) { foreach($attachment->item()->media() as $media) { - $id = $id +1; - array_push($pannellum_ids, "pv-{$id}"); $mediaType = $media->mediaType(); $mediaRenderer = $media->renderer(); if (strpos($mediaType, 'image/') !== false) { @@ -91,7 +89,7 @@ class PanoramaViewer extends AbstractBlockLayout 'title' => $block->dataValue('title'), 'height' => $block->dataValue('height'), 'urls' => $urls, - 'pannellum_ids' => $pannellum_ids, + 'id' => 'pv-' . ++$id, ]); } } diff --git a/view/common/block-layout/panorama-viewer.phtml b/view/common/block-layout/panorama-viewer.phtml index 59eda80..144fddc 100644 --- a/view/common/block-layout/panorama-viewer.phtml +++ b/view/common/block-layout/panorama-viewer.phtml @@ -17,12 +17,12 @@
-
+