forked from Islandora-Devops/islandora-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks-24551727-fixed-mirador-block.patch
54 lines (52 loc) · 2.04 KB
/
tasks-24551727-fixed-mirador-block.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Index: web/modules/contrib/islandora_defaults/modules/islandora_mirador/src/Plugin/Block/MiradorBlock.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web/modules/contrib/islandora_defaults/modules/islandora_mirador/src/Plugin/Block/MiradorBlock.php (date 1606509418942)
+++ web/modules/contrib/islandora_defaults/modules/islandora_mirador/src/Plugin/Block/MiradorBlock.php (date 1606509418942)
@@ -4,6 +4,7 @@
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Cache\Cache;
+use Drupal\Core\Entity\EntityBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Routing\RouteMatchInterface;
@@ -107,21 +108,23 @@
*/
public function build() {
$node = $this->routeMatch->getParameter('node');
- $manifest_url = $this->token->replace($this->configuration['iiif_manifest_url'], ['node' => $node]);
- $id = 'mirador_' . $node->id();
- $build = [
- "#title" => $this->t('Mirador Viewer'),
- "#description" => $this->t("A div for mirador viewer"),
- "#theme" => "mirador",
- '#mirador_view_id' => $id,
- '#iiif_manifest_url' => $manifest_url,
- "#attached" => [
- 'drupalSettings' => [
- 'iiif_manifest_url' => $manifest_url,
- 'mirador_view_id' => $id,
- ],
- ],
- ];
+ if ($node instanceof EntityBase) {
+ $manifest_url = $this->token->replace($this->configuration['iiif_manifest_url'], ['node' => $node]);
+ $id = 'mirador_' . $node->id();
+ $build = [
+ "#title" => $this->t('Mirador Viewer'),
+ "#description" => $this->t("A div for mirador viewer"),
+ "#theme" => "mirador",
+ '#mirador_view_id' => $id,
+ '#iiif_manifest_url' => $manifest_url,
+ "#attached" => [
+ 'drupalSettings' => [
+ 'iiif_manifest_url' => $manifest_url,
+ 'mirador_view_id' => $id,
+ ]
+ ]
+ ];
+ }
return $build;
}