Skip to content

Commit 4a4518c

Browse files
committed
ISSUE-125: Addressed feedback
1 parent 66db9a0 commit 4a4518c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Plugin/Field/FieldFormatter/StrawberryMediaFormatter.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,6 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
233233
// yet.
234234
// @see https://github.com/esmero/format_strawberry/issues/1
235235

236-
//@ TODO recheck cache tags here, since we are not really using
237-
// the file itself.
238236
$iiifpublicinfojson = $iiifhelper->getPublicInfoJson($iiifidentifier);
239237

240238
$groupid = 'iiif-' . $items->getName() . '-' . $nodeuuid . '-' . $delta . '-media';
@@ -254,6 +252,11 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
254252
'data-iiif-thumbnails' => $thumbnails,
255253
'style' => "width:{$max_width_css}; height:{$max_height}px",
256254
],
255+
//@ TODO recheck cache tags here, since we are not really using
256+
// the file itself.
257+
'#cache' => [
258+
'tags' => $file->getCacheTags(),
259+
],
257260
];
258261
if (isset($item->_attributes)) {
259262
$elements[$delta] += ['#attributes' => []];
@@ -291,7 +294,8 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
291294
// This also never runs if cached. So after deletion we better
292295
// call the controller!
293296
if (!empty($jsondata['ap:annotationCollection']) && is_array($jsondata['ap:annotationCollection'])) {
294-
WebAnnotationController::primeKeyStore($items[$delta]);
297+
$keystoreid = $elements[$delta]['media' . $i]['#attached']['drupalSettings']['format_strawberryfield']['openseadragon'][$uniqueid]['keystoreid'];
298+
WebAnnotationController::primeKeyStore($keystoreid);
295299
}
296300
}
297301
if ($this->currentUser) {

0 commit comments

Comments
 (0)