From 83015250574468b80138538573bed8217ab68f42 Mon Sep 17 00:00:00 2001
From: Eli Zoller <5439169+elizoller@users.noreply.github.com>
Date: Wed, 17 Mar 2021 19:57:16 -0700
Subject: [PATCH] captions v2 (#826)
---
.../islandora_audio/islandora_audio.module | 15 ++
.../IslandoraFileAudioFormatter.php | 28 +++
.../templates/islandora-file-audio.html.twig | 28 +++
.../islandora_video/islandora_video.module | 15 ++
.../IslandoraFileVideoFormatter.php | 95 ++++++++
.../templates/islandora-file-video.html.twig | 27 +++
.../IslandoraFileMediaFormatterBase.php | 92 +++++++
src/Plugin/Field/FieldType/MediaTrackItem.php | 224 ++++++++++++++++++
.../Field/FieldWidget/MediaTrackWidget.php | 173 ++++++++++++++
9 files changed, 697 insertions(+)
create mode 100644 modules/islandora_audio/src/Plugin/Field/FieldFormatter/IslandoraFileAudioFormatter.php
create mode 100644 modules/islandora_audio/templates/islandora-file-audio.html.twig
create mode 100644 modules/islandora_video/src/Plugin/Field/FieldFormatter/IslandoraFileVideoFormatter.php
create mode 100644 modules/islandora_video/templates/islandora-file-video.html.twig
create mode 100644 src/Plugin/Field/FieldFormatter/IslandoraFileMediaFormatterBase.php
create mode 100644 src/Plugin/Field/FieldType/MediaTrackItem.php
create mode 100644 src/Plugin/Field/FieldWidget/MediaTrackWidget.php
diff --git a/modules/islandora_audio/islandora_audio.module b/modules/islandora_audio/islandora_audio.module
index a5093c1b3..07b938406 100644
--- a/modules/islandora_audio/islandora_audio.module
+++ b/modules/islandora_audio/islandora_audio.module
@@ -30,3 +30,18 @@ function islandora_audio_help($route_name, RouteMatchInterface $route_match) {
default:
}
}
+
+/**
+ * Implements hook_theme().
+ */
+function islandora_audio_theme() {
+ return [
+ 'islandora_file_audio' => [
+ 'variables' => [
+ 'files' => [],
+ 'tracks' => NULL,
+ 'attributes' => NULL,
+ ],
+ ],
+ ];
+}
diff --git a/modules/islandora_audio/src/Plugin/Field/FieldFormatter/IslandoraFileAudioFormatter.php b/modules/islandora_audio/src/Plugin/Field/FieldFormatter/IslandoraFileAudioFormatter.php
new file mode 100644
index 000000000..579da554e
--- /dev/null
+++ b/modules/islandora_audio/src/Plugin/Field/FieldFormatter/IslandoraFileAudioFormatter.php
@@ -0,0 +1,28 @@
+
+ {% for file in files %}
+
+ {% if tracks %}
+ {% for track in tracks %}
+