From 0d2e5843164a5704a8bf5ae9c01b590ec1ff935d Mon Sep 17 00:00:00 2001
From: Simon Hieu Mai <simonhm@users.noreply.github.com>
Date: Mon, 30 Jan 2023 11:03:39 -0600
Subject: [PATCH 01/64] Update islandora_advanced_search.module

---
 .../islandora_advanced_search.module             | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/modules/islandora_advanced_search/islandora_advanced_search.module b/modules/islandora_advanced_search/islandora_advanced_search.module
index cbf52667..a389a29d 100644
--- a/modules/islandora_advanced_search/islandora_advanced_search.module
+++ b/modules/islandora_advanced_search/islandora_advanced_search.module
@@ -42,22 +42,6 @@ function islandora_advanced_search_theme() {
   ];
 }
 
-/**
- * Implements hook_library_info_alter().
- */
-function islandora_advanced_search_library_info_alter(&$libraries, $extension) {
-  if ($extension == 'facets') {
-    // Override facets module javascript with customizations.
-    $path = '/' . drupal_get_path('module', 'islandora_advanced_search') . '/js/facets';
-    $libraries['soft-limit']['js'] = [
-      "$path/soft-limit.js" => [],
-    ];
-    $libraries['drupal.facets.views-ajax']['js'] = [
-      "$path/facets-views-ajax.js" => [],
-    ];
-  }
-}
-
 /**
  * Implements hook_search_api_solr_converted_query_alter().
  */

From af224e42cfdd743ca5e22e0716a787e3e4869e88 Mon Sep 17 00:00:00 2001
From: Simon Hieu Mai <simonhm@users.noreply.github.com>
Date: Mon, 30 Jan 2023 11:04:17 -0600
Subject: [PATCH 02/64] Delete facets-views-ajax.js

---
 .../js/facets/facets-views-ajax.js            | 147 ------------------
 1 file changed, 147 deletions(-)
 delete mode 100644 modules/islandora_advanced_search/js/facets/facets-views-ajax.js

diff --git a/modules/islandora_advanced_search/js/facets/facets-views-ajax.js b/modules/islandora_advanced_search/js/facets/facets-views-ajax.js
deleted file mode 100644
index 0b04ea33..00000000
--- a/modules/islandora_advanced_search/js/facets/facets-views-ajax.js
+++ /dev/null
@@ -1,147 +0,0 @@
-//# sourceURL=modules/contrib/islandora/modules/islandora_advanced_search/js/facets/facets-view.ajax.js
-/**
- * @file
- * Overrides the facets-view-ajax.js behavior from the 'facets' module.
- */
-(function ($, Drupal) {
-  "use strict";
-
-  // Generate events on push state.
-  (function (history) {
-    var pushState = history.pushState;
-    history.pushState = function (state, title, url) {
-      var ret = pushState.apply(this, arguments);
-      var event = new Event("pushstate");
-      window.dispatchEvent(event);
-      return ret;
-    };
-  })(window.history);
-
-  function reload(url) {
-    // Update View.
-    if (drupalSettings && drupalSettings.views && drupalSettings.views.ajaxViews) {
-      var view_path = drupalSettings.views.ajax_path;
-      $.each(drupalSettings.views.ajaxViews, function (views_dom_id) {
-        var views_parameters = Drupal.Views.parseQueryString(url);
-        var views_arguments = Drupal.Views.parseViewArgs(url, "search");
-        var views_settings = $.extend(
-          {},
-          Drupal.views.instances[views_dom_id].settings,
-          views_arguments,
-          views_parameters
-        );
-        var views_ajax_settings =
-          Drupal.views.instances[views_dom_id].element_settings;
-        views_ajax_settings.submit = views_settings;
-        views_ajax_settings.url =
-          view_path + "?" + $.param(Drupal.Views.parseQueryString(url));
-        Drupal.ajax(views_ajax_settings).execute();
-      });
-    }
-
-    // Replace filter, pager, summary, and facet blocks.
-    var blocks = {};
-    $(
-      ".block[class*='block-plugin-id--islandora-advanced-search-result-pager'], .block[class*='block-plugin-id--views-exposed-filter-block'], .block[class*='block-plugin-id--facet']"
-    ).each(function () {
-      var id = $(this).attr("id");
-      var block_id = id
-        .slice("block-".length, id.length)
-        .replace(/--.*$/g, "")
-        .replace(/-/g, "_");
-      blocks[block_id] = "#" + id;
-    });
-    Drupal.ajax({
-      url: Drupal.url("islandora-advanced-search-ajax-blocks"),
-      submit: {
-        link: url,
-        blocks: blocks,
-      },
-    }).execute();
-  }
-
-  // On location change reload all the blocks / ajax view.
-  window.addEventListener("pushstate", function (e) {
-    reload(window.location.href);
-  });
-
-  window.addEventListener("popstate", function (e) {
-    if (e.state != null) {
-      reload(window.location.href);
-    }
-  });
-
-  /**
-   * Push state on form/pager/facet change.
-   */
-  Drupal.behaviors.islandoraAdvancedSearchViewsAjax = {
-    attach: function (context, settings) {
-      window.historyInitiated = true;
-
-      // Remove existing behavior from form.
-      if (settings && settings.views && settings.views.ajaxViews) {
-        $.each(settings.views.ajaxViews, function (index, settings) {
-          var exposed_form = $(
-            "form#views-exposed-form-" +
-            settings.view_name.replace(/_/g, "-") +
-            "-" +
-            settings.view_display_id.replace(/_/g, "-")
-          );
-          exposed_form
-            .once()
-            .find("input[type=submit], input[type=image]")
-            .not("[data-drupal-selector=edit-reset]")
-            .each(function (index) {
-              $(this).unbind("click");
-              $(this).click(function (e) {
-                // Let ctrl/cmd click open in a new window.
-                if (e.shiftKey || e.ctrlKey || e.metaKey) {
-                  return;
-                }
-                e.preventDefault();
-                e.stopPropagation();
-                var href = window.location.href;
-                var params = Drupal.Views.parseQueryString(href);
-                // Remove the page if set as submitting the form should always take
-                // the user to the first page (facets do the same).
-                delete params.page;
-                // Include values from the form in the URL.
-                $.each(exposed_form.serializeArray(), function () {
-                  params[this.name] = this.value;
-                });
-                href = href.split("?")[0] + "?" + $.param(params);
-                window.history.pushState(null, document.title, href);
-              });
-            });
-        });
-      }
-
-      // Attach behavior to pager, summary, facet links.
-      $("[data-drupal-pager-id], [data-drupal-facets-summary-id], [data-drupal-facet-id]")
-        .once()
-        .find("a:not(.facets-soft-limit-link)")
-        .click(function (e) {
-          // Let ctrl/cmd click open in a new window.
-          if (e.shiftKey || e.ctrlKey || e.metaKey) {
-            return;
-          }
-          e.preventDefault();
-          window.history.pushState(null, document.title, $(this).attr("href"));
-        });
-
-      // Trigger on sort change.
-      $('[data-drupal-pager-id] select[name="order"]')
-        .once()
-        .change(function () {
-          var href = window.location.href;
-          var params = Drupal.Views.parseQueryString(href);
-          var selection = $(this).val();
-          var option = $('option[value="' + selection + '"]');
-          params.sort_order = option.data("sort_order");
-          params.sort_by = option.data("sort_by");
-          href = href.split("?")[0] + "?" + $.param(params);
-          window.history.pushState(null, document.title, href);
-        });
-    },
-  };
-})(jQuery, Drupal);

From da35fb8950ca0efaaf7ffed64a59421eb5f26113 Mon Sep 17 00:00:00 2001
From: Simon Hieu Mai <simonhm@users.noreply.github.com>
Date: Mon, 30 Jan 2023 11:04:26 -0600
Subject: [PATCH 03/64] Delete soft-limit.js

---
 .../js/facets/soft-limit.js                   | 70 -------------------
 1 file changed, 70 deletions(-)
 delete mode 100644 modules/islandora_advanced_search/js/facets/soft-limit.js

diff --git a/modules/islandora_advanced_search/js/facets/soft-limit.js b/modules/islandora_advanced_search/js/facets/soft-limit.js
deleted file mode 100644
index a81a267c..00000000
--- a/modules/islandora_advanced_search/js/facets/soft-limit.js
+++ /dev/null
@@ -1,70 +0,0 @@
-//# sourceURL=modules/contrib/islandora/modules/islandora_advanced_search/js/facets/soft-limit.js
-/**
- * @file
- * Overrides the soft-limit.js behavior from the 'facets' module.
- * As when having many facets the original version causes the page to slow down and snap to hidden when rendering.
- */
-(function ($) {
-
-  'use strict';
-
-  Drupal.behaviors.facetSoftLimit = {
-    attach: function (context, settings) {
-      if (settings.facets.softLimit !== 'undefined') {
-        $.each(settings.facets.softLimit, function (facet, limit) {
-          Drupal.facets.applySoftLimit(facet, limit, settings);
-        });
-      }
-    }
-  };
-
-  Drupal.facets = Drupal.facets || {};
-
-  /**
-   * Applies the soft limit UI feature to a specific facets list.
-   *
-   * @param {string} facet
-   *   The facet id.
-   * @param {string} limit
-   *   The maximum amount of items to show.
-   * @param {object} settings
-   *   Settings.
-   */
-  Drupal.facets.applySoftLimit = function (facet, limit, settings) {
-    var zero_based_limit = (limit - 1);
-    var facet_id = facet;
-    var facetsList = $('ul[data-drupal-facet-id="' + facet_id + '"]');
-
-    // In case of multiple instances of a facet, we need to key them.
-    if (facetsList.length > 1) {
-      facetsList.each(function (key, $value) {
-        $(this).attr('data-drupal-facet-id', facet_id + '-' + key);
-      });
-    }
-
-    // Add "Show more" / "Show less" links.
-    facetsList.filter(function () {
-      return $(this).next('ul').length == 1; // Has expanding list.
-    }).each(function () {
-      var facet = $(this);
-      var expand = facet.next('ul');
-      var link = expand.next('a');
-      var showLessLabel = settings.facets.softLimitSettings[facet_id].showLessLabel;
-      var showMoreLabel = settings.facets.softLimitSettings[facet_id].showMoreLabel;
-      link.text(showMoreLabel)
-        .once()
-        .on('click', function () {
-          if (!expand.is(":visible")) {
-            expand.slideDown();
-            $(this).addClass('open').text(showLessLabel);
-          }
-          else {
-            expand.slideUp();
-            $(this).removeClass('open').text(showMoreLabel);
-          }
-          return false;
-        })
-    });
-  };
-
-})(jQuery);

From 71c720736ffef366208d01738e20c86104686a6f Mon Sep 17 00:00:00 2001
From: Simon Hieu Mai <simonhm@users.noreply.github.com>
Date: Thu, 2 Feb 2023 16:03:58 -0600
Subject: [PATCH 04/64] Update islandora_advanced_search.module

---
 .../islandora_advanced_search.module          | 84 -------------------
 1 file changed, 84 deletions(-)

diff --git a/modules/islandora_advanced_search/islandora_advanced_search.module b/modules/islandora_advanced_search/islandora_advanced_search.module
index a389a29d..ad70d2f9 100644
--- a/modules/islandora_advanced_search/islandora_advanced_search.module
+++ b/modules/islandora_advanced_search/islandora_advanced_search.module
@@ -22,26 +22,6 @@ use Drupal\search_api\Query\QueryInterface as DrupalQueryInterface;
 use Drupal\views\ViewExecutable;
 use Solarium\Core\Query\QueryInterface as SolariumQueryInterface;
 
-/**
- * Implements hook_theme().
- */
-function islandora_advanced_search_theme() {
-  return [
-    'facets_item_list__include_exclude_links' => [
-      'template' => 'facets/facets-item-list--include-exclude-links',
-      'base hook' => 'facets_item_list',
-    ],
-    'facets_result_item__include_exclude_links' => [
-      'template' => 'facets/facets-result-item--include-exclude-links',
-      'base hook' => 'facets_result_item',
-    ],
-    'facets_result_item__summary' => [
-      'template' => 'facets/facets-result-item--summary',
-      'base hook' => 'facets_result_item',
-    ],
-  ];
-}
-
 /**
  * Implements hook_search_api_solr_converted_query_alter().
  */
@@ -83,20 +63,6 @@ function islandora_advanced_search_form_block_form_alter(&$form, FormStateInterf
   $form['visibility'][$condition_id] = $condition_form;
 }
 
-/**
- * Implements hook_preprocess_block__facets_summary().
- */
-function islandora_advanced_search_preprocess_block__facets_summary(&$variables) {
-  // Copy data-attributes to the content as the javascript expects
-  // there to be no elements between the data declaration and the
-  // content of the block.
-  foreach ($variables['attributes'] as $key => $value) {
-    if (substr($key, 0, 4) === "data") {
-      $variables['content_attributes'][$key] = $value;
-    }
-  }
-}
-
 /**
  * Implements hook_preprocess_preprocess_views_view().
  */
@@ -123,53 +89,3 @@ function islandora_advanced_search_views_pre_view(ViewExecutable $view, $display
   $advanced_search_query = new AdvancedSearchQuery();
   $advanced_search_query->alterView(\Drupal::request(), $view, $display_id);
 }
-
-/**
- * Implements hook_preprocess_facets_summary_item_list().
- */
-function islandora_advanced_search_preprocess_facets_summary_item_list(&$variables) {
-  foreach ($variables['items'] as &$item) {
-    $item['attributes']['class'][] = 'facet-summary-item';
-  }
-}
-
-/**
- * Implements hook_preprocess_facets_item_list().
- */
-function islandora_advanced_search_preprocess_facets_item_list(&$variables) {
-  $widget = $variables['facet']->getWidget();
-  $soft_limit = $widget['config']['soft_limit'];
-  // Break into two groups less / more which can display be toggled as a single
-  // element change rather than showing / hiding all <li> elements individually.
-  // As its slow and causes the page to snap when loading.
-  $variables['less'] = array_slice($variables['items'], 0, $soft_limit);
-  $variables['more'] = array_slice($variables['items'], $soft_limit);
-  $variables['show_more_label'] = $widget['config']['soft_limit_settings']['show_more_label'];
-}
-
-/**
- * Implements hook_preprocess_facets_result_item().
- */
-function islandora_advanced_search_preprocess_facets_result_item(&$variables) {
-  $settings = \Drupal::config(SettingsForm::CONFIG_NAME);
-  $length = $settings->get(SettingsForm::FACET_TRUNCATE);
-  if (is_numeric($length)) {
-    // Limit the length of facets display to at most 32 characters.
-    if (is_string($variables['value'])) {
-      $variables['value'] = Unicode::truncate(
-        $variables['value'],
-        $length,
-        TRUE,
-        TRUE
-      );
-    }
-    elseif (is_string($variables['value']['text']['#title'])) {
-      $variables['value']['text']['#title'] = Unicode::truncate(
-        $variables['value']['text']['#title'],
-        $length,
-        TRUE,
-        TRUE
-          );
-    }
-  }
-}

From 488a82b741d4ff52cf0a63152e96c992d4ccf7e9 Mon Sep 17 00:00:00 2001
From: Simon Hieu Mai <simonhm@users.noreply.github.com>
Date: Thu, 2 Feb 2023 16:23:17 -0600
Subject: [PATCH 05/64] Update islandora_advanced_search.module

---
 .../islandora_advanced_search/islandora_advanced_search.module  | 2 --
 1 file changed, 2 deletions(-)

diff --git a/modules/islandora_advanced_search/islandora_advanced_search.module b/modules/islandora_advanced_search/islandora_advanced_search.module
index ad70d2f9..f08dd346 100644
--- a/modules/islandora_advanced_search/islandora_advanced_search.module
+++ b/modules/islandora_advanced_search/islandora_advanced_search.module
@@ -13,10 +13,8 @@
  */
 
 use Drupal\block\Entity\Block;
-use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\islandora_advanced_search\AdvancedSearchQuery;
-use Drupal\islandora_advanced_search\Form\SettingsForm;
 use Drupal\islandora_advanced_search\Utilities;
 use Drupal\search_api\Query\QueryInterface as DrupalQueryInterface;
 use Drupal\views\ViewExecutable;

From 2376f7783107de247285b8e68063e88cbda1f7a7 Mon Sep 17 00:00:00 2001
From: JojoVes <JojoVes@users.noreply.github.com>
Date: Wed, 1 Feb 2023 14:23:10 -0400
Subject: [PATCH 06/64] Replace deprecated 'context' condition annotation with
 'context_definitions' (#925)

There was a cleanup done for this deprecation in https://github.com/Islandora/islandora/pull/764
before the 'NodeReferencedByNode' condition was made, then the deprecated annotation must have
just been missed in reviewing https://github.com/Islandora/islandora/pull/808.
---
 src/Plugin/Condition/NodeReferencedByNode.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Plugin/Condition/NodeReferencedByNode.php b/src/Plugin/Condition/NodeReferencedByNode.php
index a2abac80..c5611a3e 100644
--- a/src/Plugin/Condition/NodeReferencedByNode.php
+++ b/src/Plugin/Condition/NodeReferencedByNode.php
@@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  * @Condition(
  *   id = "node_referenced_by_node",
  *   label = @Translation("Node is referenced by other nodes"),
- *   context = {
+ *   context_definitions = {
  *     "node" = @ContextDefinition("entity:node", required = TRUE , label = @Translation("node"))
  *   }
  * )

From ee2b964a076ca4df93af55c1045997ca1ea03603 Mon Sep 17 00:00:00 2001
From: Ant Brown <ant@antbrown.com>
Date: Thu, 9 Feb 2023 09:30:05 +1300
Subject: [PATCH 07/64] Fix deprecated File::url(), use createFileUrl() instead
 (#855)

* islandora.tokens.inc
* See https://www.drupal.org/node/3019830
Co-authored-by: Ant Brown <ant@catalyst.net.nz>
---
 islandora.tokens.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/islandora.tokens.inc b/islandora.tokens.inc
index 8d1c4b6b..abbe6474 100644
--- a/islandora.tokens.inc
+++ b/islandora.tokens.inc
@@ -79,7 +79,7 @@ function islandora_tokens($type, $tokens, array $data, array $options, Bubbleabl
           if ($media) {
             $file = \Drupal::service('islandora.media_source_service')->getSourceFile($media);
             if (!empty($file)) {
-              $url = $file->url();
+              $url = $file->createFileUrl();
               $replacements[$original] = $url;
             }
           }

From 4e091e524fe98b94322b48f1e73ff8d195ce6e8c Mon Sep 17 00:00:00 2001
From: Seth Shaw <sshaw28@asu.edu>
Date: Thu, 9 Feb 2023 11:06:57 -0800
Subject: [PATCH 08/64] fix for deprecated Symfony Event class

---
 composer.json                    | 2 +-
 src/Event/StompHeaderEvent.php   | 2 +-
 src/EventGenerator/EmitEvent.php | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/composer.json b/composer.json
index 0b443c02..f4956d3d 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,7 @@
     "drupal/file_replace": "^1.1",
     "drupal/filehash": "^2",
     "drupal/flysystem" : "^2.0@alpha",
-    "drupal/jwt": "^1.0",
+    "drupal/jwt": "^1.1",
     "drupal/migrate_plus" : "^5.1 || ^6",
     "drupal/migrate_source_csv" : "^3.4",
     "drupal/prepopulate" : "^2.2",
diff --git a/src/Event/StompHeaderEvent.php b/src/Event/StompHeaderEvent.php
index d6d93c22..1381a920 100644
--- a/src/Event/StompHeaderEvent.php
+++ b/src/Event/StompHeaderEvent.php
@@ -6,7 +6,7 @@ use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Session\AccountInterface;
 
 use Symfony\Component\HttpFoundation\ParameterBag;
-use Symfony\Component\EventDispatcher\Event;
+use Drupal\Component\EventDispatcher\Event;
 
 /**
  * Event used to build headers for STOMP.
diff --git a/src/EventGenerator/EmitEvent.php b/src/EventGenerator/EmitEvent.php
index fd33fd99..12700d73 100644
--- a/src/EventGenerator/EmitEvent.php
+++ b/src/EventGenerator/EmitEvent.php
@@ -160,8 +160,8 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact
       $data = $this->generateData($entity);
 
       $event = $this->eventDispatcher->dispatch(
-        StompHeaderEvent::EVENT_NAME,
-        new StompHeaderEvent($entity, $user, $data, $this->getConfiguration())
+        new StompHeaderEvent($entity, $user, $data, $this->getConfiguration()),
+        StompHeaderEvent::EVENT_NAME
       );
 
       $message = new Message(

From 46cd2f99503af623456ddfcf78dc5dc767891ebd Mon Sep 17 00:00:00 2001
From: Jordan Dukart <jordan@discoverygarden.ca>
Date: Mon, 13 Mar 2023 13:12:00 -0300
Subject: [PATCH 09/64] Reset contexts before evaluation. (#932)

* Reset contexts before evaluation.
* Only reset when Islandora's ContextProviders are being used.
---
 src/IslandoraContextManager.php | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/IslandoraContextManager.php b/src/IslandoraContextManager.php
index 801e3253..c7228195 100644
--- a/src/IslandoraContextManager.php
+++ b/src/IslandoraContextManager.php
@@ -13,6 +13,14 @@ use Drupal\Component\Plugin\Exception\ContextException;
  */
 class IslandoraContextManager extends ContextManager {
 
+  /**
+   * Allow the contexts to be reset before evaluation.
+   */
+  protected function resetContextEvaluation() {
+    $this->contexts = [];
+    $this->contextConditionsEvaluated = FALSE;
+  }
+
   /**
    * Evaluate all context conditions.
    *
@@ -22,7 +30,11 @@ class IslandoraContextManager extends ContextManager {
   public function evaluateContexts(array $provided = []) {
 
     $this->activeContexts = [];
-
+    // XXX: Ensure that no earlier executed contexts in the request are still
+    // present when being triggered via Islandora's ContextProviders.
+    if (!empty($provided)) {
+      $this->resetContextEvaluation();
+    }
     /** @var \Drupal\context\ContextInterface $context */
     foreach ($this->getContexts() as $context) {
       if ($this->evaluateContextConditions($context, $provided) && !$context->disabled()) {

From c67f3185ec3ca293a96a44e65a8369c3026208f0 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Wed, 8 Mar 2023 10:25:38 -0400
Subject: [PATCH 10/64] Update Crayfish Commons dependency

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index f4956d3d..96f3e886 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,7 @@
     "drupal/prepopulate" : "^2.2",
     "drupal/search_api": "^1.8",
     "drupal/token" : "^1.3",
-    "islandora/crayfish-commons": "^2",
+    "islandora/crayfish-commons": "^3",
     "islandora/jsonld": "^2",
     "stomp-php/stomp-php": "4.* || ^5"
   },

From 709938cf291baba1b6748b05b8d94a3f54185d60 Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Fri, 17 Feb 2023 16:56:42 +0100
Subject: [PATCH 11/64] Implement solution for drupal issues 3089660 and
 3045666

---
 src/IslandoraContextManager.php | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/IslandoraContextManager.php b/src/IslandoraContextManager.php
index c7228195..a8f18772 100644
--- a/src/IslandoraContextManager.php
+++ b/src/IslandoraContextManager.php
@@ -60,7 +60,11 @@ class IslandoraContextManager extends ContextManager {
     $conditions = $context->getConditions();
 
     // Apply context to any context aware conditions.
-    $this->applyContexts($conditions, $provided);
+    // Abort if the application of contexts has been unsuccessful
+    // similarly to BlockAccessControlHandler::checkAccess().
+    if (!$this->applyContexts($conditions, $provided)) {
+      return FALSE;
+    }
 
     // Set the logic to use when validating the conditions.
     $logic = $context->requiresAllConditions()
@@ -88,6 +92,7 @@ class IslandoraContextManager extends ContextManager {
    *   TRUE if conditions pass
    */
   protected function applyContexts(ConditionPluginCollection &$conditions, array $provided = []) {
+    $passed = FALSE;
     foreach ($conditions as $condition) {
       if ($condition instanceof ContextAwarePluginInterface) {
         try {
@@ -98,14 +103,15 @@ class IslandoraContextManager extends ContextManager {
             $contexts = $provided;
           }
           $this->contextHandler->applyContextMapping($condition, $contexts);
+          $passed = TRUE;
         }
         catch (ContextException $e) {
-          return FALSE;
+          continue;
         }
       }
     }
 
-    return TRUE;
+    return $passed;
   }
 
 }

From 9f83322902457ce390e21b818d72a1722db51929 Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Fri, 17 Feb 2023 16:57:50 +0100
Subject: [PATCH 12/64] Check if action is appropriate for entity before
 executing

---
 src/PresetReaction/PresetReaction.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PresetReaction/PresetReaction.php b/src/PresetReaction/PresetReaction.php
index 98aa6946..e516eb24 100644
--- a/src/PresetReaction/PresetReaction.php
+++ b/src/PresetReaction/PresetReaction.php
@@ -56,7 +56,10 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto
     $action_ids = $config['actions'];
     foreach ($action_ids as $action_id) {
       $action = $this->actionStorage->load($action_id);
-      $action->execute([$entity]);
+      // Make sure that the action is appropriate for the entity.
+      if ($entity->getEntityTypeId() === $action->getType()) {
+        $action->execute([$entity]);
+      }
     }
   }
 

From 2c48c8795fb10f2d6764688ffb1555be82cec833 Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Mon, 20 Feb 2023 21:25:48 +0100
Subject: [PATCH 13/64] Check if conditions exist before applying contexts to
 them

---
 src/IslandoraContextManager.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/IslandoraContextManager.php b/src/IslandoraContextManager.php
index a8f18772..15fac41f 100644
--- a/src/IslandoraContextManager.php
+++ b/src/IslandoraContextManager.php
@@ -62,7 +62,7 @@ class IslandoraContextManager extends ContextManager {
     // Apply context to any context aware conditions.
     // Abort if the application of contexts has been unsuccessful
     // similarly to BlockAccessControlHandler::checkAccess().
-    if (!$this->applyContexts($conditions, $provided)) {
+    if (count($conditions) > 0 && !$this->applyContexts($conditions, $provided)) {
       return FALSE;
     }
 

From 50685aebe6353c5acb4ea16a0d529d8eca3cd130 Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Mon, 20 Feb 2023 21:26:18 +0100
Subject: [PATCH 14/64] Make sure that the action is appropriate: either system
 or with same entity type

---
 src/PresetReaction/PresetReaction.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PresetReaction/PresetReaction.php b/src/PresetReaction/PresetReaction.php
index e516eb24..532606fc 100644
--- a/src/PresetReaction/PresetReaction.php
+++ b/src/PresetReaction/PresetReaction.php
@@ -56,8 +56,8 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto
     $action_ids = $config['actions'];
     foreach ($action_ids as $action_id) {
       $action = $this->actionStorage->load($action_id);
-      // Make sure that the action is appropriate for the entity.
-      if ($entity->getEntityTypeId() === $action->getType()) {
+      // Make sure that the action is appropriate: either system or with same entity type.
+      if ($action->getType() === 'system' || $entity->getEntityTypeId() === $action->getType()) {
         $action->execute([$entity]);
       }
     }

From 088f1fcdd06939af1916ac6e909ac52bd0af3e17 Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Tue, 21 Feb 2023 08:06:00 +0100
Subject: [PATCH 15/64] Comment too long

---
 src/PresetReaction/PresetReaction.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PresetReaction/PresetReaction.php b/src/PresetReaction/PresetReaction.php
index 532606fc..18a771dc 100644
--- a/src/PresetReaction/PresetReaction.php
+++ b/src/PresetReaction/PresetReaction.php
@@ -56,7 +56,8 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto
     $action_ids = $config['actions'];
     foreach ($action_ids as $action_id) {
       $action = $this->actionStorage->load($action_id);
-      // Make sure that the action is appropriate: either system or with same entity type.
+      // Make sure that the action is appropriate:
+      // either system action or with same type as the entity type.
       if ($action->getType() === 'system' || $entity->getEntityTypeId() === $action->getType()) {
         $action->execute([$entity]);
       }

From 1bbb48f70fed5229d1e446a652223927963c0936 Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Tue, 28 Feb 2023 10:09:18 +0100
Subject: [PATCH 16/64] Be consistent with context module, issue 3177007

---
 src/IslandoraContextManager.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/IslandoraContextManager.php b/src/IslandoraContextManager.php
index 15fac41f..9fd93fbc 100644
--- a/src/IslandoraContextManager.php
+++ b/src/IslandoraContextManager.php
@@ -62,7 +62,7 @@ class IslandoraContextManager extends ContextManager {
     // Apply context to any context aware conditions.
     // Abort if the application of contexts has been unsuccessful
     // similarly to BlockAccessControlHandler::checkAccess().
-    if (count($conditions) > 0 && !$this->applyContexts($conditions, $provided)) {
+    if (!$this->applyContexts($conditions, $provided)) {
       return FALSE;
     }
 
@@ -92,6 +92,12 @@ class IslandoraContextManager extends ContextManager {
    *   TRUE if conditions pass
    */
   protected function applyContexts(ConditionPluginCollection &$conditions, array $provided = []) {
+
+    // If no contexts to check, the return should be TRUE.
+    // For example, empty is the same as sitewide condition.
+    if (count($conditions) === 0) {
+      return TRUE;
+    }
     $passed = FALSE;
     foreach ($conditions as $condition) {
       if ($condition instanceof ContextAwarePluginInterface) {

From b82accf7635dd67e1c7621049c9500cd0a61c60a Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Tue, 14 Mar 2023 11:16:48 +0100
Subject: [PATCH 17/64] Revert "Comment too long"

This reverts commit aba5052308f994d47527e7daddd75854313060b9.
---
 src/PresetReaction/PresetReaction.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/PresetReaction/PresetReaction.php b/src/PresetReaction/PresetReaction.php
index 18a771dc..532606fc 100644
--- a/src/PresetReaction/PresetReaction.php
+++ b/src/PresetReaction/PresetReaction.php
@@ -56,8 +56,7 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto
     $action_ids = $config['actions'];
     foreach ($action_ids as $action_id) {
       $action = $this->actionStorage->load($action_id);
-      // Make sure that the action is appropriate:
-      // either system action or with same type as the entity type.
+      // Make sure that the action is appropriate: either system or with same entity type.
       if ($action->getType() === 'system' || $entity->getEntityTypeId() === $action->getType()) {
         $action->execute([$entity]);
       }

From 4bcc7d441783395c8f018ed537b2ca61cb87a7ea Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Tue, 14 Mar 2023 11:18:22 +0100
Subject: [PATCH 18/64] Revert "Make sure that the action is appropriate:
 either system or with same entity type"

This reverts commit a409d402aa53a7640ca12f8ce2209ccdf605b89a.
---
 src/PresetReaction/PresetReaction.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PresetReaction/PresetReaction.php b/src/PresetReaction/PresetReaction.php
index 532606fc..e516eb24 100644
--- a/src/PresetReaction/PresetReaction.php
+++ b/src/PresetReaction/PresetReaction.php
@@ -56,8 +56,8 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto
     $action_ids = $config['actions'];
     foreach ($action_ids as $action_id) {
       $action = $this->actionStorage->load($action_id);
-      // Make sure that the action is appropriate: either system or with same entity type.
-      if ($action->getType() === 'system' || $entity->getEntityTypeId() === $action->getType()) {
+      // Make sure that the action is appropriate for the entity.
+      if ($entity->getEntityTypeId() === $action->getType()) {
         $action->execute([$entity]);
       }
     }

From ee451667d4954573264d961bb29440a8b93f77b0 Mon Sep 17 00:00:00 2001
From: Lucas van Schaik <schaik@library.leidenuniv.nl>
Date: Tue, 14 Mar 2023 11:18:30 +0100
Subject: [PATCH 19/64] Revert "Check if action is appropriate for entity
 before executing"

This reverts commit 87f475d81c0bca3793c9f3bdc6cf8def4f31ef6b.
---
 src/PresetReaction/PresetReaction.php | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/PresetReaction/PresetReaction.php b/src/PresetReaction/PresetReaction.php
index e516eb24..98aa6946 100644
--- a/src/PresetReaction/PresetReaction.php
+++ b/src/PresetReaction/PresetReaction.php
@@ -56,10 +56,7 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto
     $action_ids = $config['actions'];
     foreach ($action_ids as $action_id) {
       $action = $this->actionStorage->load($action_id);
-      // Make sure that the action is appropriate for the entity.
-      if ($entity->getEntityTypeId() === $action->getType()) {
-        $action->execute([$entity]);
-      }
+      $action->execute([$entity]);
     }
   }
 

From 7d54a42d4804f4f54918832aa7df0a153bbf0407 Mon Sep 17 00:00:00 2001
From: "Noah W. Smith" <noah@born-digital.com>
Date: Fri, 31 Mar 2023 12:55:30 -0400
Subject: [PATCH 20/64] Update maintainer and sponsor info

Maintainer switched to TAG; Sponsors sorted, one correction, and links added
---
 README.md | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index d891c0e6..839a14e3 100644
--- a/README.md
+++ b/README.md
@@ -91,21 +91,22 @@ Having problems or solved a problem? Check out the Islandora google groups for a
 
 Current maintainers:
 
-* [Danny Lamb](https://github.com/dannylamb)
+* [Islandora Technical Advisory Group]([https://github.com/dannylamb](https://github.com/Islandora/islandora-community/wiki/Technical-Advisory-Group-%28TAG%29))
 
 ## Sponsors
 
-* UPEI
-* discoverygarden inc.
-* LYRASIS
-* McMaster University
-* University of Limerick
-* York University
-* University of Manitoba
-* Simon Fraser University
-* PALS
 * American Philosophical Society
-* Common Media Inc.
+
+* [Born-Digital, Inc.](https://www.born-digital.com/)
+* [discoverygarden inc.](https://www.discoverygarden.ca/)
+* [LYRASIS](https://www.lyrasis.org/)
+* [McMaster University](https://www.mcmaster.ca/)
+* [PALS](https://www.mnpals.org/)
+* [University of Limerick](https://www.ul.ie/)
+* [University of Manitoba](https://umanitoba.ca/)
+* [UPEI](https://www.upei.ca/)
+* [Simon Fraser University](https://www.sfu.ca/)
+* [York University](https://www.yorku.ca/)
 
 ## Development
 

From 58da2a6af1f7ea548ad6952811e02d944491bf31 Mon Sep 17 00:00:00 2001
From: "Noah W. Smith" <noah@born-digital.com>
Date: Fri, 31 Mar 2023 12:57:37 -0400
Subject: [PATCH 21/64] Missed one link; corrected TAG link

---
 README.md | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 839a14e3..32e69ea9 100644
--- a/README.md
+++ b/README.md
@@ -91,12 +91,11 @@ Having problems or solved a problem? Check out the Islandora google groups for a
 
 Current maintainers:
 
-* [Islandora Technical Advisory Group]([https://github.com/dannylamb](https://github.com/Islandora/islandora-community/wiki/Technical-Advisory-Group-%28TAG%29))
+* [Islandora Technical Advisory Group](https://github.com/Islandora/islandora-community/wiki/Technical-Advisory-Group-%28TAG%29)
 
 ## Sponsors
 
-* American Philosophical Society
-
+* [American Philosophical Society](https://www.amphilsoc.org/)
 * [Born-Digital, Inc.](https://www.born-digital.com/)
 * [discoverygarden inc.](https://www.discoverygarden.ca/)
 * [LYRASIS](https://www.lyrasis.org/)

From 8ce1ad2cda65cfa73c535c170de02130ec5fecba Mon Sep 17 00:00:00 2001
From: Jared Whiklo <jwhiklo@gmail.com>
Date: Wed, 15 Mar 2023 17:03:46 -0500
Subject: [PATCH 22/64] Remove deprecate MimeTypeGuesser

Use test upgraded Crayfish-Commons
---
 composer.json                           |  2 +-
 islandora.services.yml                  |  3 +++
 src/Flysystem/Adapter/FedoraAdapter.php | 30 ++++++++++++++++++-------
 src/Flysystem/Fedora.php                | 24 +++++++++++++++-----
 4 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/composer.json b/composer.json
index 96f3e886..a92aff53 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,7 @@
     "drupal/prepopulate" : "^2.2",
     "drupal/search_api": "^1.8",
     "drupal/token" : "^1.3",
-    "islandora/crayfish-commons": "^3",
+    "islandora/crayfish-commons": "dev-upgrade-5.4-symfony",
     "islandora/jsonld": "^2",
     "stomp-php/stomp-php": "4.* || ^5"
   },
diff --git a/islandora.services.yml b/islandora.services.yml
index 4108e244..465e8d93 100644
--- a/islandora.services.yml
+++ b/islandora.services.yml
@@ -31,6 +31,9 @@ services:
   logger.channel.islandora:
       parent: logger.channel_base
       arguments: ['islandora']
+  logger.channel.fedora_flysystem:
+      parent: logger.channel_base
+      arguments: ['fedora_flysystem']
   islandora.media_route_context_provider:
     class: Drupal\islandora\ContextProvider\MediaRouteContextProvider
     arguments: ['@current_route_match']
diff --git a/src/Flysystem/Adapter/FedoraAdapter.php b/src/Flysystem/Adapter/FedoraAdapter.php
index 58be909c..eb79220d 100644
--- a/src/Flysystem/Adapter/FedoraAdapter.php
+++ b/src/Flysystem/Adapter/FedoraAdapter.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\islandora\Flysystem\Adapter;
 
+use Drupal\Core\Logger\LoggerChannelInterface;
 use Islandora\Chullo\IFedoraApi;
 use League\Flysystem\AdapterInterface;
 use League\Flysystem\Adapter\Polyfill\NotSupportingVisibilityTrait;
@@ -9,7 +10,7 @@ use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait;
 use League\Flysystem\Config;
 use GuzzleHttp\Psr7\Response;
 use GuzzleHttp\Psr7\StreamWrapper;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
+use Symfony\Component\Mime\MimeTypeGuesserInterface;
 
 /**
  * Fedora adapter for Flysystem.
@@ -29,21 +30,34 @@ class FedoraAdapter implements AdapterInterface {
   /**
    * Mimetype guesser.
    *
-   * @var \Symfony\Component\HttpFoundation\File\Mimetype\MimeTypeGuesserInterface
+   * @var \Symfony\Component\Mime\MimeTypeGuesserInterface
    */
   protected $mimeTypeGuesser;
 
+    /**
+     * Logger.
+     *
+     * @var \Drupal\Core\Logger\LoggerChannelInterface
+     */
+  protected $logger;
+
   /**
    * Constructs a Fedora adapter for Flysystem.
    *
    * @param \Islandora\Chullo\IFedoraApi $fedora
    *   Fedora client.
-   * @param \Symfony\Component\HttpFoundation\File\Mimetype\MimeTypeGuesserInterface $mime_type_guesser
+   * @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mime_type_guesser
    *   Mimetype guesser.
+   * @param \Drupal\Core\Logger\LoggerChannelInterface $logger
    */
-  public function __construct(IFedoraApi $fedora, MimeTypeGuesserInterface $mime_type_guesser) {
+  public function __construct(
+    IFedoraApi $fedora,
+    MimeTypeGuesserInterface $mime_type_guesser,
+    LoggerChannelInterface $logger
+  ) {
     $this->fedora = $fedora;
     $this->mimeTypeGuesser = $mime_type_guesser;
+    $this->logger = $logger;
   }
 
   /**
@@ -259,7 +273,7 @@ class FedoraAdapter implements AdapterInterface {
    */
   public function write($path, $contents, Config $config) {
     $headers = [
-      'Content-Type' => $this->mimeTypeGuesser->guess($path),
+      'Content-Type' => $this->mimeTypeGuesser->guessMimeType($path),
     ];
     if ($this->has($path)) {
       $fedora_url = $path;
@@ -274,17 +288,17 @@ class FedoraAdapter implements AdapterInterface {
           $headers
         );
         if (isset($response) && $response->getStatusCode() == 201) {
-          \Drupal::logger('fedora_flysystem')->info('Created a version in Fedora for ' . $fedora_url);
+          $this->logger->info('Created a version in Fedora for ' . $fedora_url);
         }
         else {
-          \Drupal::logger('fedora_flysystem')->error(
+          $this->logger->error(
             "Client error: `Failed to create a Fedora version of $fedora_url`. Response is " . print_r($response, TRUE)
           );
 
         }
       }
       catch (\Exception $e) {
-        \Drupal::logger('fedora_flysystem')->error('Caught exception when creating version: ' . $e->getMessage() . "\n");
+        $this->logger->error('Caught exception when creating version: ' . $e->getMessage() . "\n");
       }
     }
 
diff --git a/src/Flysystem/Fedora.php b/src/Flysystem/Fedora.php
index fe7af7ba..a2ae81e3 100644
--- a/src/Flysystem/Fedora.php
+++ b/src/Flysystem/Fedora.php
@@ -3,6 +3,7 @@
 namespace Drupal\islandora\Flysystem;
 
 use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Logger\LoggerChannelInterface;
 use Drupal\Core\Logger\RfcLogLevel;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Url;
@@ -17,7 +18,7 @@ use Islandora\Chullo\IFedoraApi;
 use Islandora\Chullo\FedoraApi;
 use Psr\Http\Message\RequestInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
+use Symfony\Component\Mime\MimeTypeGuesserInterface;
 
 /**
  * Drupal plugin for the Fedora Flysystem adapter.
@@ -38,7 +39,7 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
   /**
    * Mimetype guesser.
    *
-   * @var \Symfony\Component\HttpFoundation\File\Mimetype\MimeTypeGuesserInterface
+   * @var \Symfony\Component\Mime\MimeTypeGuesserInterface
    */
   protected $mimeTypeGuesser;
 
@@ -49,24 +50,34 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
    */
   protected $languageManager;
 
+    /**
+     * Logger.
+     *
+     * @var \Drupal\Core\Logger\LoggerChannelInterface
+     */
+  protected $logger;
+
   /**
    * Constructs a Fedora plugin for Flysystem.
    *
    * @param \Islandora\Chullo\IFedoraApi $fedora
    *   Fedora client.
-   * @param \Symfony\Component\HttpFoundation\File\Mimetype\MimeTypeGuesserInterface $mime_type_guesser
+   * @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mime_type_guesser
    *   Mimetype guesser.
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
    *   Language manager.
+   * @param \Drupal\Core\Logger\LoggerChannelInterface $logger
    */
   public function __construct(
     IFedoraApi $fedora,
     MimeTypeGuesserInterface $mime_type_guesser,
-    LanguageManagerInterface $language_manager
+    LanguageManagerInterface $language_manager,
+    LoggerChannelInterface $logger
   ) {
     $this->fedora = $fedora;
     $this->mimeTypeGuesser = $mime_type_guesser;
     $this->languageManager = $language_manager;
+    $this->logger = $logger;
   }
 
   /**
@@ -87,7 +98,8 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
     return new static(
       $fedora,
       $container->get('file.mime_type.guesser'),
-      $container->get('language_manager')
+      $container->get('language_manager'),
+      $container->get('logger.channel.fedora_flysystem')
     );
   }
 
@@ -116,7 +128,7 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
    * {@inheritdoc}
    */
   public function getAdapter() {
-    return new FedoraAdapter($this->fedora, $this->mimeTypeGuesser);
+    return new FedoraAdapter($this->fedora, $this->mimeTypeGuesser, $this->logger);
   }
 
   /**

From 2c1d88f400f5a948b39ab957f56e4ea9a6bdefe5 Mon Sep 17 00:00:00 2001
From: Jared Whiklo <jwhiklo@gmail.com>
Date: Wed, 22 Mar 2023 12:56:35 -0500
Subject: [PATCH 23/64] Use new package

---
 composer.json          | 5 +++--
 islandora.services.yml | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/composer.json b/composer.json
index a92aff53..a2693862 100644
--- a/composer.json
+++ b/composer.json
@@ -27,13 +27,14 @@
     "drupal/prepopulate" : "^2.2",
     "drupal/search_api": "^1.8",
     "drupal/token" : "^1.3",
-    "islandora/crayfish-commons": "dev-upgrade-5.4-symfony",
+    "islandora/chullo": "^1.3",
+    "islandora/fedora-entity-mapper": "1.x-dev",
     "islandora/jsonld": "^2",
     "stomp-php/stomp-php": "4.* || ^5"
   },
   "require-dev": {
     "phpunit/phpunit": "^6",
-    "squizlabs/php_codesniffer": "2.7.1",
+    "squizlabs/php_codesniffer": "^2.7.1",
     "drupal/coder": "*",
     "sebastian/phpcpd": "*"
   },
diff --git a/islandora.services.yml b/islandora.services.yml
index 465e8d93..74725d80 100644
--- a/islandora.services.yml
+++ b/islandora.services.yml
@@ -56,7 +56,7 @@ services:
     class: Drupal\islandora\IslandoraUtils
     arguments: ['@entity_type.manager', '@entity_field.manager', '@context.manager', '@flysystem_factory', '@language_manager']
   islandora.entity_mapper:
-    class: Islandora\Crayfish\Commons\EntityMapper\EntityMapper
+    class: Islandora\EntityMapper\EntityMapper
   islandora.stomp.auth_header_listener:
     class: Drupal\islandora\EventSubscriber\StompHeaderEventSubscriber
     arguments: ['@jwt.authentication.jwt']

From 5dd96b8f22b878431961ac7f47d224f51628ff61 Mon Sep 17 00:00:00 2001
From: Jared Whiklo <jwhiklo@gmail.com>
Date: Tue, 18 Apr 2023 14:46:32 -0500
Subject: [PATCH 24/64] Use new chullo static methods

---
 composer.json            | 2 +-
 src/Flysystem/Fedora.php | 6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/composer.json b/composer.json
index a2693862..0db75d4a 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,7 @@
     "drupal/prepopulate" : "^2.2",
     "drupal/search_api": "^1.8",
     "drupal/token" : "^1.3",
-    "islandora/chullo": "^1.3",
+    "islandora/chullo": "dev-update-dependencies",
     "islandora/fedora-entity-mapper": "1.x-dev",
     "islandora/jsonld": "^2",
     "stomp-php/stomp-php": "4.* || ^5"
diff --git a/src/Flysystem/Fedora.php b/src/Flysystem/Fedora.php
index a2ae81e3..5a3a68d8 100644
--- a/src/Flysystem/Fedora.php
+++ b/src/Flysystem/Fedora.php
@@ -88,11 +88,7 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
     // Construct guzzle client to middleware that adds JWT.
     $stack = HandlerStack::create();
     $stack->push(static::addJwt($container->get('jwt.authentication.jwt')));
-    $client = new Client([
-      'handler' => $stack,
-      'base_uri' => $configuration['root'],
-    ]);
-    $fedora = new FedoraApi($client);
+    $fedora = FedoraApi::createWithHandler($configuration['root'], $stack);
 
     // Return it.
     return new static(

From 860abf3c06573def2a514fde29bf8316bb138930 Mon Sep 17 00:00:00 2001
From: Jared Whiklo <jwhiklo@gmail.com>
Date: Wed, 19 Apr 2023 12:27:24 -0500
Subject: [PATCH 25/64] code style

---
 src/Flysystem/Adapter/FedoraAdapter.php | 11 ++++++-----
 src/Flysystem/Fedora.php                | 14 +++++++-------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/Flysystem/Adapter/FedoraAdapter.php b/src/Flysystem/Adapter/FedoraAdapter.php
index eb79220d..4ebc61c5 100644
--- a/src/Flysystem/Adapter/FedoraAdapter.php
+++ b/src/Flysystem/Adapter/FedoraAdapter.php
@@ -34,11 +34,11 @@ class FedoraAdapter implements AdapterInterface {
    */
   protected $mimeTypeGuesser;
 
-    /**
-     * Logger.
-     *
-     * @var \Drupal\Core\Logger\LoggerChannelInterface
-     */
+  /**
+   * Logger.
+   *
+   * @var \Drupal\Core\Logger\LoggerChannelInterface
+   */
   protected $logger;
 
   /**
@@ -49,6 +49,7 @@ class FedoraAdapter implements AdapterInterface {
    * @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mime_type_guesser
    *   Mimetype guesser.
    * @param \Drupal\Core\Logger\LoggerChannelInterface $logger
+   *   The fedora adapter logger channel.
    */
   public function __construct(
     IFedoraApi $fedora,
diff --git a/src/Flysystem/Fedora.php b/src/Flysystem/Fedora.php
index 5a3a68d8..0cbf1a12 100644
--- a/src/Flysystem/Fedora.php
+++ b/src/Flysystem/Fedora.php
@@ -13,9 +13,8 @@ use Drupal\islandora\Flysystem\Adapter\FedoraAdapter;
 use Drupal\jwt\Authentication\Provider\JwtAuth;
 use GuzzleHttp\Exception\ConnectException;
 use GuzzleHttp\HandlerStack;
-use GuzzleHttp\Client;
-use Islandora\Chullo\IFedoraApi;
 use Islandora\Chullo\FedoraApi;
+use Islandora\Chullo\IFedoraApi;
 use Psr\Http\Message\RequestInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\Mime\MimeTypeGuesserInterface;
@@ -50,11 +49,11 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
    */
   protected $languageManager;
 
-    /**
-     * Logger.
-     *
-     * @var \Drupal\Core\Logger\LoggerChannelInterface
-     */
+  /**
+   * Logger.
+   *
+   * @var \Drupal\Core\Logger\LoggerChannelInterface
+   */
   protected $logger;
 
   /**
@@ -67,6 +66,7 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
    *   Language manager.
    * @param \Drupal\Core\Logger\LoggerChannelInterface $logger
+   *   The fedora adapter logger channel.
    */
   public function __construct(
     IFedoraApi $fedora,

From ba93ad35a34cd3313e2e56198ad070d0d88092d5 Mon Sep 17 00:00:00 2001
From: Jared Whiklo <jwhiklo@gmail.com>
Date: Wed, 19 Apr 2023 13:00:14 -0500
Subject: [PATCH 26/64] Fix tests

---
 tests/src/Kernel/FedoraAdapterTest.php | 87 +++++++++++---------------
 tests/src/Kernel/FedoraPluginTest.php  |  8 ++-
 2 files changed, 43 insertions(+), 52 deletions(-)

diff --git a/tests/src/Kernel/FedoraAdapterTest.php b/tests/src/Kernel/FedoraAdapterTest.php
index 10c5beb1..a3b577e4 100644
--- a/tests/src/Kernel/FedoraAdapterTest.php
+++ b/tests/src/Kernel/FedoraAdapterTest.php
@@ -2,12 +2,13 @@
 
 namespace Drupal\Tests\islandora\Kernel;
 
+use Drupal\Core\Logger\LoggerChannelInterface;
 use Drupal\islandora\Flysystem\Adapter\FedoraAdapter;
 use GuzzleHttp\Psr7\Response;
 use Islandora\Chullo\IFedoraApi;
 use League\Flysystem\Config;
 use Prophecy\Argument;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
+use Symfony\Component\Mime\MimeTypeGuesserInterface;
 
 /**
  * Tests the Fedora adapter for Flysystem.
@@ -17,6 +18,30 @@ use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
  */
 class FedoraAdapterTest extends IslandoraKernelTestBase {
 
+  /**
+   * A mimetype guesser prophecy.
+   *
+   * @var \Prophecy\Prophecy\ObjectProphecy
+   */
+  private $mime_guesser;
+
+  /**
+   * A logger prophecy.
+   *
+   * @var \Prophecy\Prophecy\ObjectProphecy
+   */
+  private $logger;
+
+  /**
+   * @inheritdoc
+   */
+  public function setUp() {
+      parent::setUp();
+      $this->mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
+        ->reveal();
+      $this->logger = $this->prophesize(LoggerChannelInterface::class)->reveal();
+  }
+
   /**
    * Shared functionality for an adapter.
    */
@@ -55,10 +80,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $prophecy->getResource('', ['Connection' => 'close'])->willReturn($response);
     $api = $prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -73,10 +95,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $prophecy->getResource('', ['Connection' => 'close'])->willReturn($response);
     $api = $prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -98,10 +117,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($response);
     $api = $prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -126,10 +142,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -149,10 +162,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -180,10 +190,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -199,10 +206,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $fedora_prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($prophecy->reveal());
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -218,10 +222,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -249,10 +250,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -280,10 +278,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    return new FedoraAdapter($api, $mime_guesser);
+    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
   }
 
   /**
@@ -644,10 +639,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    $adapter = new FedoraAdapter($api, $mime_guesser);
+    $adapter = new FedoraAdapter($api, $this->mime_guesser, $this->logger);
 
     $this->assertTrue($adapter->rename('', '') == TRUE, "rename() must return TRUE on success");
   }
@@ -664,10 +656,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-      ->reveal();
-
-    $adapter = new FedoraAdapter($api, $mime_guesser);
+    $adapter = new FedoraAdapter($api, $this->mime_guesser, $this->logger);
 
     $this->assertTrue($adapter->createDir('', $this->prophesize(Config::class)
       ->reveal()) == FALSE, "createDir() must return FALSE on fail");
diff --git a/tests/src/Kernel/FedoraPluginTest.php b/tests/src/Kernel/FedoraPluginTest.php
index 67491507..cd1c8325 100644
--- a/tests/src/Kernel/FedoraPluginTest.php
+++ b/tests/src/Kernel/FedoraPluginTest.php
@@ -2,11 +2,12 @@
 
 namespace Drupal\Tests\islandora\Kernel;
 
+use Drupal\Core\Logger\LoggerChannelInterface;
 use Drupal\islandora\Flysystem\Fedora;
-use League\Flysystem\AdapterInterface;
 use Islandora\Chullo\IFedoraApi;
+use League\Flysystem\AdapterInterface;
 use Psr\Http\Message\ResponseInterface;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
+use Symfony\Component\Mime\MimeTypeGuesserInterface;
 
 /**
  * Tests the Fedora plugin for Flysystem.
@@ -32,8 +33,9 @@ class FedoraPluginTest extends IslandoraKernelTestBase {
     $mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)->reveal();
 
     $language_manager = $this->container->get('language_manager');
+    $logger = $this->prophesize(LoggerChannelInterface::class)->reveal();
 
-    return new Fedora($api, $mime_guesser, $language_manager);
+    return new Fedora($api, $mime_guesser, $language_manager, $logger);
   }
 
   /**

From ff4e0cafc4dd59b0703516a1cccd19356be58d96 Mon Sep 17 00:00:00 2001
From: Jared Whiklo <jwhiklo@gmail.com>
Date: Wed, 19 Apr 2023 13:40:34 -0500
Subject: [PATCH 27/64] More code style

---
 tests/src/Kernel/FedoraAdapterTest.php | 36 +++++++++++++-------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/tests/src/Kernel/FedoraAdapterTest.php b/tests/src/Kernel/FedoraAdapterTest.php
index a3b577e4..e5161063 100644
--- a/tests/src/Kernel/FedoraAdapterTest.php
+++ b/tests/src/Kernel/FedoraAdapterTest.php
@@ -23,7 +23,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
    *
    * @var \Prophecy\Prophecy\ObjectProphecy
    */
-  private $mime_guesser;
+  private $mimeGuesser;
 
   /**
    * A logger prophecy.
@@ -33,13 +33,13 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
   private $logger;
 
   /**
-   * @inheritdoc
+   * {@inheritdoc}
    */
   public function setUp() {
-      parent::setUp();
-      $this->mime_guesser = $this->prophesize(MimeTypeGuesserInterface::class)
-        ->reveal();
-      $this->logger = $this->prophesize(LoggerChannelInterface::class)->reveal();
+    parent::setUp();
+    $this->mimeGuesser = $this->prophesize(MimeTypeGuesserInterface::class)
+      ->reveal();
+    $this->logger = $this->prophesize(LoggerChannelInterface::class)->reveal();
   }
 
   /**
@@ -80,7 +80,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $prophecy->getResource('', ['Connection' => 'close'])->willReturn($response);
     $api = $prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -95,7 +95,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $prophecy->getResource('', ['Connection' => 'close'])->willReturn($response);
     $api = $prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -117,7 +117,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($response);
     $api = $prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -142,7 +142,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -162,7 +162,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -190,7 +190,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -206,7 +206,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $fedora_prophecy->getResourceHeaders('', ['Connection' => 'close'])->willReturn($prophecy->reveal());
     $api = $fedora_prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -222,7 +222,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -250,7 +250,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -278,7 +278,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    return new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    return new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
   }
 
   /**
@@ -639,7 +639,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $adapter = new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    $adapter = new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
 
     $this->assertTrue($adapter->rename('', '') == TRUE, "rename() must return TRUE on success");
   }
@@ -656,7 +656,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
 
     $api = $fedora_prophecy->reveal();
 
-    $adapter = new FedoraAdapter($api, $this->mime_guesser, $this->logger);
+    $adapter = new FedoraAdapter($api, $this->mimeGuesser, $this->logger);
 
     $this->assertTrue($adapter->createDir('', $this->prophesize(Config::class)
       ->reveal()) == FALSE, "createDir() must return FALSE on fail");

From 7b0ff739cd8bd8f354b2085c34ae93a72bfac55b Mon Sep 17 00:00:00 2001
From: Jared Whiklo <jwhiklo@gmail.com>
Date: Thu, 27 Apr 2023 09:34:09 -0500
Subject: [PATCH 28/64] Update dependencies to tagged versions

---
 composer.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/composer.json b/composer.json
index 0db75d4a..3ceed0e1 100644
--- a/composer.json
+++ b/composer.json
@@ -27,8 +27,8 @@
     "drupal/prepopulate" : "^2.2",
     "drupal/search_api": "^1.8",
     "drupal/token" : "^1.3",
-    "islandora/chullo": "dev-update-dependencies",
-    "islandora/fedora-entity-mapper": "1.x-dev",
+    "islandora/chullo": "^2.0",
+    "islandora/fedora-entity-mapper": "^1.0",
     "islandora/jsonld": "^2",
     "stomp-php/stomp-php": "4.* || ^5"
   },

From 138eab201673bdeed163dcbe2a1db7476c3f5fb6 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <aloneill@gmail.com>
Date: Wed, 3 May 2023 16:42:03 -0300
Subject: [PATCH 29/64] Issue #941: Only add <br/> tags to plain text extracted
 text fields. (#942)

* Issue #941: Only add <br/> tags to plain text extracted text fields.

* Fix PHPCS errors.

* Don't add <br /> tags to edited OCR text field if it looks like hOCR.

* Respond to PHPCS errors.
---
 .../islandora_text_extraction.module                        | 4 ++++
 .../src/Controller/MediaSourceController.php                | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/islandora_text_extraction/islandora_text_extraction.module b/modules/islandora_text_extraction/islandora_text_extraction.module
index 5d6f6437..ca330dd4 100644
--- a/modules/islandora_text_extraction/islandora_text_extraction.module
+++ b/modules/islandora_text_extraction/islandora_text_extraction.module
@@ -40,6 +40,10 @@ function islandora_text_extraction_media_presave(MediaInterface $media) {
       $file = File::load($file_id);
       if ($file) {
         $data = file_get_contents($file->getFileUri());
+        // Check if it's already markup like hOCR.
+        if (substr($data, 0, 5) == '<?xml') {
+          return;
+        }
         $data = nl2br($data);
         $media->set('field_edited_text', $data);
         $media->field_edited_text->format = 'basic_html';
diff --git a/modules/islandora_text_extraction/src/Controller/MediaSourceController.php b/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
index 14c36ebd..f15e42d5 100644
--- a/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
+++ b/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
@@ -108,7 +108,11 @@ class MediaSourceController extends ControllerBase {
         $this->getLogger('islandora')->warning("Field $destination_field is not defined in  Media Type {$media->bundle()}");
       }
       if ($media->hasField($destination_text_field)) {
-        $media->{$destination_text_field}->setValue(nl2br($contents));
+        // @todo The request actually has a malformed parameter string, ?text_format=plain_text?connection_close=true.
+        if (substr($request->query->get('text_format'), 0, 10) == 'plain_text') {
+          $contents = nl2br($contents);
+        }
+        $media->{$destination_text_field}->setValue($contents);
       }
       else {
         $this->getLogger('islandora')->warning("Field $destination_text_field is not defined in Media Type {$media->bundle()}");

From 06dd1651ac6a57a868a8e6bac63b2ff38f9eaeeb Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Tue, 2 May 2023 12:34:47 -0300
Subject: [PATCH 30/64] Issue #939: Fix incorrect IIIF Manifest canvas Ids.

---
 modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index c2a2fbc3..90945664 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -136,7 +136,7 @@ class IIIFManifest extends StylePluginBase {
       $request_url = $this->request->getRequestUri();
       // Strip off the last URI component to get the base ID of the URL.
       // @todo assumming the view is a path like /node/1/manifest.json
-      $url_components = explode('/', $request_url);
+      $url_components = explode('/', trim($request_url, '/'));
       array_pop($url_components);
       $content_path = implode('/', $url_components);
       $iiif_base_id = $request_host . '/' . $content_path;

From 0bd05b6c449b1c7ec586e025b0ba5f816809c6bc Mon Sep 17 00:00:00 2001
From: kstapelfeldt <kirstastapelfeldt@gmail.com>
Date: Fri, 5 May 2023 11:11:59 -0400
Subject: [PATCH 31/64] Update README.md

Remove lobster holding 8 sign.
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 32e69ea9..546d2192 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# ![Islandora](https://cloud.githubusercontent.com/assets/2371345/25624809/f95b0972-2f30-11e7-8992-a8f135402cdc.png) Islandora
+# Islandora
 
 [![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg?style=flat-square)](https://php.net/)
 [![Build Status](https://github.com/islandora/islandora/actions/workflows/build-2.x.yml/badge.svg)](https://github.com/Islandora/islandora/actions)

From 78baec07e844819db630d4520f40d61d84b3a4a9 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Fri, 21 Apr 2023 15:46:01 -0300
Subject: [PATCH 32/64] Issue #973 Add hooks to IIIF manifest Views Style
 plugin.

---
 .../src/Plugin/views/style/IIIFManifest.php   | 31 +++++++++++++++++--
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 90945664..ed054176 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -4,6 +4,7 @@ namespace Drupal\islandora_iiif\Plugin\views\style;
 
 use Drupal\views\Plugin\views\style\StylePluginBase;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
+use \Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Messenger\MessengerInterface;
 use Drupal\Core\Url;
@@ -90,11 +91,16 @@ class IIIFManifest extends StylePluginBase {
    * @var \Drupal\Core\Messenger\MessengerInterface
    */
   protected $messenger;
+  
+  /**
+   * @var \Drupal\Core\Extention\ModuleHandlerInterface;
+   */
+  protected $moduleHandler;
 
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger, ModuleHandlerInterface $moduleHandler) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
 
     $this->serializer = $serializer;
@@ -104,6 +110,7 @@ class IIIFManifest extends StylePluginBase {
     $this->fileSystem = $file_system;
     $this->httpClient = $http_client;
     $this->messenger = $messenger;
+    $this->moduleHandler = $moduleHandler;
   }
 
   /**
@@ -120,10 +127,21 @@ class IIIFManifest extends StylePluginBase {
       $container->get('entity_type.manager'),
       $container->get('file_system'),
       $container->get('http_client'),
-      $container->get('messenger')
+      $container->get('messenger'),
+      $container->get('module_handler')
     );
   }
 
+  /**
+   * Return the request property.
+   * 
+   * @return \Symfony\Component\HttpFoundation\Request
+   *   The Symfony request object
+   */
+  public function getRequest() {
+    return $this->request;
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -170,6 +188,9 @@ class IIIFManifest extends StylePluginBase {
 
     $content_type = 'json';
 
+    // Give other modules a chance to alter the manifest.
+    $this->moduleHandler->alter('islandora_iiif_manifest', $json, $this);
+
     return $this->serializer->serialize($json, $content_type, ['views_style_plugin' => $this]);
   }
 
@@ -288,11 +309,15 @@ class IIIFManifest extends StylePluginBase {
             ];
           }
 
+          // Give other modules a chance to alter the canvas
+          $alter_options = ['options' => $this->options, 'views_plugin' => $this];
+          $this->moduleHandler->alter('islandora_iiif_manifest_canvas', $tmp_canvas, $row, $alter_options);
+
           $canvases[] = $tmp_canvas;
         }
       }
     }
-
+    
     return $canvases;
   }
 

From 43f32d1bcfbbbc279ae3678e6b610fbe59c3bbad Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Fri, 21 Apr 2023 16:40:51 -0300
Subject: [PATCH 33/64] Issue #937: Fix PHPCS issues.

---
 .../src/Plugin/views/style/IIIFManifest.php   | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index ed054176..3501ada5 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -4,7 +4,7 @@ namespace Drupal\islandora_iiif\Plugin\views\style;
 
 use Drupal\views\Plugin\views\style\StylePluginBase;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
-use \Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Messenger\MessengerInterface;
 use Drupal\Core\Url;
@@ -91,9 +91,11 @@ class IIIFManifest extends StylePluginBase {
    * @var \Drupal\Core\Messenger\MessengerInterface
    */
   protected $messenger;
-  
+
   /**
-   * @var \Drupal\Core\Extention\ModuleHandlerInterface;
+   * Module Handler for running hooks.
+   * 
+   * @var \Drupal\Core\Extention\ModuleHandlerInterface
    */
   protected $moduleHandler;
 
@@ -134,7 +136,7 @@ class IIIFManifest extends StylePluginBase {
 
   /**
    * Return the request property.
-   * 
+   *
    * @return \Symfony\Component\HttpFoundation\Request
    *   The Symfony request object
    */
@@ -309,15 +311,18 @@ class IIIFManifest extends StylePluginBase {
             ];
           }
 
-          // Give other modules a chance to alter the canvas
-          $alter_options = ['options' => $this->options, 'views_plugin' => $this];
+          // Give other modules a chance to alter the canvas.
+          $alter_options = [
+            'options' => $this->options,
+            'views_plugin' => $this
+          ];
           $this->moduleHandler->alter('islandora_iiif_manifest_canvas', $tmp_canvas, $row, $alter_options);
 
           $canvases[] = $tmp_canvas;
         }
       }
     }
-    
+
     return $canvases;
   }
 

From 5bc1584dd7189add4b1101075507d62a3358b738 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Fri, 21 Apr 2023 16:57:50 -0300
Subject: [PATCH 34/64] Issue 937: More PHPCS fixes.

---
 .../islandora_iiif/src/Plugin/views/style/IIIFManifest.php    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 3501ada5..55fe3634 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -94,7 +94,7 @@ class IIIFManifest extends StylePluginBase {
 
   /**
    * Module Handler for running hooks.
-   * 
+   *
    * @var \Drupal\Core\Extention\ModuleHandlerInterface
    */
   protected $moduleHandler;
@@ -314,7 +314,7 @@ class IIIFManifest extends StylePluginBase {
           // Give other modules a chance to alter the canvas.
           $alter_options = [
             'options' => $this->options,
-            'views_plugin' => $this
+            'views_plugin' => $this,
           ];
           $this->moduleHandler->alter('islandora_iiif_manifest_canvas', $tmp_canvas, $row, $alter_options);
 

From 17b5049578fb7152f5d032c06137628b45024761 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Fri, 2 Jun 2023 16:30:09 -0300
Subject: [PATCH 35/64] Issue #944: Un-hide arguments field in Text Extraction
 action.

---
 .../src/Plugin/Action/GenerateOCRDerivative.php            | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php b/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php
index 63a714a8..9d171622 100644
--- a/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php
+++ b/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php
@@ -37,11 +37,10 @@ class GenerateOCRDerivative extends AbstractGenerateDerivative {
    */
   public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
     $form = parent::buildConfigurationForm($form, $form_state);
-    $form['mimetype']['#description'] = $this->t('Mimetype to convert to (e.g. application/xml, etc...)');
-    $form['mimetype']['#value'] = 'text/plain';
-    $form['mimetype']['#type'] = 'textfield';
+    
 
-    unset($form['args']);
+    $form['args']['#description'] = $this->t("Arguments to send to Tesseract. To generate hOCR, use:<br /><code>-c tessedit_create_hocr=1 -c hocr_font_info=0</code>");
+    
     return $form;
   }
 

From 61c6e737c103f88bb9d9c2895327ea211473747b Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Tue, 6 Jun 2023 19:58:05 -0300
Subject: [PATCH 36/64] Fix PHPCS errors.

---
 .../src/Plugin/Action/GenerateOCRDerivative.php                | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php b/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php
index 9d171622..272e9f01 100644
--- a/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php
+++ b/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php
@@ -37,10 +37,9 @@ class GenerateOCRDerivative extends AbstractGenerateDerivative {
    */
   public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
     $form = parent::buildConfigurationForm($form, $form_state);
-    
 
     $form['args']['#description'] = $this->t("Arguments to send to Tesseract. To generate hOCR, use:<br /><code>-c tessedit_create_hocr=1 -c hocr_font_info=0</code>");
-    
+
     return $form;
   }
 

From a7eaacc1d5086fb0d2c21f78cae17e7970b0ffb5 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Fri, 9 Jun 2023 16:26:18 -0300
Subject: [PATCH 37/64] Issue #947 Add tokens for Original File filename,
 extension.

---
 islandora.tokens.inc | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/islandora.tokens.inc b/islandora.tokens.inc
index abbe6474..f69418af 100644
--- a/islandora.tokens.inc
+++ b/islandora.tokens.inc
@@ -19,6 +19,18 @@ function islandora_token_info() {
     'name' => t('Islandora Tokens'),
     'description' => t('Tokens for Islandora objects.'),
   ];
+  $node['media-original-file:filename'] = [
+    'name' => t('Media: Original File filename without extension.'),
+    'description' => t('File name without extension of original uploaded file associated with Islandora Object via Media.'),
+  ];
+  $node['media-original-file:basename'] = [
+    'name' => t('Media: Original File filename with extension.'),
+    'description' => t('File name with extension of original uploaded file associated with Islandora Object via Media.'),
+  ];
+  $node['media-original-file:extension'] = [
+    'name' => t('Media: Original File extension.'),
+    'description' => t('File extension of original uploaded file associated with Islandora Object via Media.'),
+  ];
   $node['media-thumbnail-image:url'] = [
     'name' => t('Media: Thumbnail Image URL.'),
     'description' => t('URL of Thumbnail Image associated with Islandora Object via Media.'),
@@ -70,6 +82,23 @@ function islandora_tokens($type, $tokens, array $data, array $options, Bubbleabl
     $islandoraUtils = \Drupal::service('islandora.utils');
     foreach ($tokens as $name => $original) {
       switch ($name) {
+        case 'media-original-file:basename':
+        case 'media-original-file:filename':
+        case 'media-original-file:extension':
+          $term = $islandoraUtils->getTermForUri('http://pcdm.org/use#OriginalFile');
+          $media = $islandoraUtils->getMediaWithTerm($data['node'], $term);
+          // Is there media?
+          if ($media) {
+            $file = \Drupal::service('islandora.media_source_service')->getSourceFile($media);
+            if (!empty($file)) {
+              $path_info = pathinfo($file->createFileUrl());
+              $key = explode(':', $name)[1];
+              if (array_key_exists($key, $path_info)) {
+                $replacements[$original] = $path_info[$key];
+              }
+            }
+          }
+          break;
         case 'media-thumbnail-image:url':
         case 'media_thumbnail_image:url':
           $term = $islandoraUtils->getTermForUri('http://pcdm.org/use#ThumbnailImage');

From 374ab02d07f4ce56d1afc8ceb23974335c6f1d62 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Thu, 15 Jun 2023 12:03:22 -0300
Subject: [PATCH 38/64] phpcs

---
 islandora.tokens.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/islandora.tokens.inc b/islandora.tokens.inc
index f69418af..ab7bb073 100644
--- a/islandora.tokens.inc
+++ b/islandora.tokens.inc
@@ -99,6 +99,7 @@ function islandora_tokens($type, $tokens, array $data, array $options, Bubbleabl
             }
           }
           break;
+
         case 'media-thumbnail-image:url':
         case 'media_thumbnail_image:url':
           $term = $islandoraUtils->getTermForUri('http://pcdm.org/use#ThumbnailImage');

From 622eaab6a0b3c6d7c4868b0789646cbaabcbd6e5 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Thu, 8 Jun 2023 11:31:13 -0300
Subject: [PATCH 39/64] Issue 944: Pull hOCR from separate media in IIIF
 manifest.

---
 .../src/Plugin/views/style/IIIFManifest.php   | 190 +++++++++++-------
 1 file changed, 115 insertions(+), 75 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 55fe3634..49c35208 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -2,22 +2,23 @@
 
 namespace Drupal\islandora_iiif\Plugin\views\style;
 
-use Drupal\views\Plugin\views\style\StylePluginBase;
+use Drupal\Core\Config\ImmutableConfig;
+use Drupal\Core\File\FileSystemInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
-use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Messenger\MessengerInterface;
 use Drupal\Core\Url;
+use Drupal\islandora\IslandoraUtils;
+use Drupal\views\Plugin\views\style\StylePluginBase;
 use Drupal\views\ResultRow;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\Serializer\SerializerInterface;
-use Symfony\Component\HttpFoundation\Request;
-use Drupal\Core\Config\ImmutableConfig;
-use Drupal\Core\File\FileSystemInterface;
 use GuzzleHttp\Client;
 use GuzzleHttp\Exception\ClientException;
 use GuzzleHttp\Exception\ConnectException;
 use GuzzleHttp\Exception\ServerException;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\Serializer\SerializerInterface;
+use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Provide serializer format for IIIF Manifest.
@@ -33,6 +34,13 @@ use GuzzleHttp\Exception\ServerException;
  */
 class IIIFManifest extends StylePluginBase {
 
+/**
+   * Islandora utility functions.
+   *
+   * @var \Drupal\islandora\IslandoraUtils
+   */
+  protected $utils;
+
   /**
    * {@inheritdoc}
    */
@@ -92,17 +100,10 @@ class IIIFManifest extends StylePluginBase {
    */
   protected $messenger;
 
-  /**
-   * Module Handler for running hooks.
-   *
-   * @var \Drupal\Core\Extention\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger, ModuleHandlerInterface $moduleHandler) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger, IslandoraUtils $utils) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
 
     $this->serializer = $serializer;
@@ -112,7 +113,8 @@ class IIIFManifest extends StylePluginBase {
     $this->fileSystem = $file_system;
     $this->httpClient = $http_client;
     $this->messenger = $messenger;
-    $this->moduleHandler = $moduleHandler;
+    $this->utils = $utils;
+
   }
 
   /**
@@ -130,20 +132,10 @@ class IIIFManifest extends StylePluginBase {
       $container->get('file_system'),
       $container->get('http_client'),
       $container->get('messenger'),
-      $container->get('module_handler')
+      $container->get('islandora.utils')
     );
   }
 
-  /**
-   * Return the request property.
-   *
-   * @return \Symfony\Component\HttpFoundation\Request
-   *   The Symfony request object
-   */
-  public function getRequest() {
-    return $this->request;
-  }
-
   /**
    * {@inheritdoc}
    */
@@ -161,6 +153,11 @@ class IIIFManifest extends StylePluginBase {
       $content_path = implode('/', $url_components);
       $iiif_base_id = $request_host . '/' . $content_path;
 
+      /**
+       * @var \Drupal\taxonomy\TermInterface|null
+       */
+      $structured_text_term = $this->utils->getTermForUri($this->options['structured_text_term_uri']);
+
       // @see https://iiif.io/api/presentation/2.1/#manifest
       $json += [
         '@type' => 'sc:Manifest',
@@ -180,7 +177,7 @@ class IIIFManifest extends StylePluginBase {
       // For each row in the View result.
       foreach ($this->view->result as $row) {
         // Add the IIIF URL to the image to print out as JSON.
-        $canvases = $this->getTileSourceFromRow($row, $iiif_address, $iiif_base_id);
+        $canvases = $this->getTileSourceFromRow($row, $iiif_address, $iiif_base_id, $structured_text_term);
         foreach ($canvases as $tile_source) {
           $json['sequences'][0]['canvases'][] = $tile_source;
         }
@@ -190,9 +187,6 @@ class IIIFManifest extends StylePluginBase {
 
     $content_type = 'json';
 
-    // Give other modules a chance to alter the manifest.
-    $this->moduleHandler->alter('islandora_iiif_manifest', $json, $this);
-
     return $this->serializer->serialize($json, $content_type, ['views_style_plugin' => $this]);
   }
 
@@ -206,18 +200,41 @@ class IIIFManifest extends StylePluginBase {
    * @param string $iiif_base_id
    *   The URL for the request, minus the last part of the URL,
    *   which is likely "manifest".
+   * @param \Drupal\taxonomy\TermInterface|null $structured_text_term
+   *   The term that structured text media references, if any.
    *
    * @return array
    *   List of IIIF URLs to display in the Openseadragon viewer.
    */
-  protected function getTileSourceFromRow(ResultRow $row, $iiif_address, $iiif_base_id) {
+  protected function getTileSourceFromRow(ResultRow $row, $iiif_address, $iiif_base_id, $structured_text_term) {
     $canvases = [];
     foreach (array_filter(array_values($this->options['iiif_tile_field'])) as $iiif_tile_field) {
       $viewsField = $this->view->field[$iiif_tile_field];
       $iiif_ocr_file_field = !empty($this->options['iiif_ocr_file_field']) ? array_filter(array_values($this->options['iiif_ocr_file_field'])) : [];
+      
       $ocrField = count($iiif_ocr_file_field) > 0 ? $this->view->field[$iiif_ocr_file_field[0]] : NULL;
       $entity = $viewsField->getEntity($row);
 
+      if ($ocrField) {
+        $ocr_entity = $entity;
+        $ocr_field_name = $ocrField->definition['field_name'];
+        if (!is_null($ocrField_name)) {
+          $ocrs = $ocr_entity->{$ocr_field_name};
+          $ocr = isset($ocrs[$i]) ? $ocrs[$i] : FALSE;
+          $ocr_url = $ocr->entity->createFileUrl(FALSE);
+        }
+      }
+      else if ($structured_text_term) {
+        $parent_node = $this->utils->getParentNode($entity);
+        $ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term);
+        $ocr_entity_id = is_array($ocr_entity_array) ? array_shift($ocr_entity_array) : NULL;
+        $ocr_entity = $ocr_entity_id ? $this->entityTypeManager->getStorage('media')->load($ocr_entity_id) : NULL;
+        $ocr_file_source = $ocr_entity ? $ocr_entity->getSource() : NULL;
+        $ocr_fid = $ocr_file_source->getSourceFieldValue($ocr_entity);
+        $ocr_file = $this->entityTypeManager->getStorage('file')->load($ocr_fid);
+        $ocr_url = $ocr_file->createFileUrl(FALSE);
+      }
+
       if (isset($entity->{$viewsField->definition['field_name']})) {
 
         /** @var \Drupal\Core\Field\FieldItemListInterface $images */
@@ -228,11 +245,6 @@ class IIIFManifest extends StylePluginBase {
             continue;
           }
 
-          if (!is_null($ocrField)) {
-            $ocrs = $entity->{$ocrField->definition['field_name']};
-            $ocr = isset($ocrs[$i]) ? $ocrs[$i] : FALSE;
-          }
-
           // Create the IIIF URL for this file
           // Visiting $iiif_url will resolve to the info.json for the image.
           $file_url = $image->entity->createFileUrl(FALSE);
@@ -243,35 +255,8 @@ class IIIFManifest extends StylePluginBase {
           $canvas_id = $iiif_base_id . '/canvas/' . $entity->id();
           $annotation_id = $iiif_base_id . '/annotation/' . $entity->id();
 
-          // Try to fetch the IIIF metadata for the image.
-          try {
-            $info_json = $this->httpClient->get($iiif_url)->getBody();
-            $resource = json_decode($info_json, TRUE);
-            $width = $resource['width'];
-            $height = $resource['height'];
-          }
-          catch (ClientException | ServerException | ConnectException $e) {
-            // If we couldn't get the info.json from IIIF
-            // try seeing if we can get it from Drupal.
-            if (empty($width) || empty($height)) {
-              // Get the image properties so we know the image width/height.
-              $properties = $image->getProperties();
-              $width = isset($properties['width']) ? $properties['width'] : 0;
-              $height = isset($properties['height']) ? $properties['height'] : 0;
-
-              // If this is a TIFF AND we don't know the width/height
-              // see if we can get the image size via PHP's core function.
-              if ($mime_type === 'image/tiff' && !$width || !$height) {
-                $uri = $image->entity->getFileUri();
-                $path = $this->fileSystem->realpath($uri);
-                $image_size = getimagesize($path);
-                if ($image_size) {
-                  $width = $image_size[0];
-                  $height = $image_size[1];
-                }
-              }
-            }
-          }
+          [$width, $height] = $this->getCanvasDimensions($iiif_url, $image, $mime_type);
+          
           $tmp_canvas = [
             // @see https://iiif.io/api/presentation/2.1/#canvas
             '@id' => $canvas_id,
@@ -302,22 +287,15 @@ class IIIFManifest extends StylePluginBase {
             ],
           ];
 
-          if (isset($ocr) && $ocr != FALSE) {
+          if ($ocr_url) {
             $tmp_canvas['seeAlso'] = [
-              '@id' => $ocr->entity->createFileUrl(FALSE),
+              '@id' => $ocr_url,
               'format' => 'text/vnd.hocr+html',
               'profile' => 'http://kba.cloud/hocr-spec',
               'label' => 'hOCR embedded text',
             ];
           }
 
-          // Give other modules a chance to alter the canvas.
-          $alter_options = [
-            'options' => $this->options,
-            'views_plugin' => $this,
-          ];
-          $this->moduleHandler->alter('islandora_iiif_manifest_canvas', $tmp_canvas, $row, $alter_options);
-
           $canvases[] = $tmp_canvas;
         }
       }
@@ -326,6 +304,50 @@ class IIIFManifest extends StylePluginBase {
     return $canvases;
   }
 
+  /**
+   * Try to fetch the IIIF metadata for the image.
+   * 
+   * @param string $iiif_url
+   *   Base URL of the canvas
+   * @param FieldItemInterface $image
+   *   The image field.
+   * @param string $mime_type
+   *   The mime type of the image.
+   * @return [string]
+   *   The width and height of the image.
+   */
+  protected function getCanvasDimensions(string $iiif_url, FieldItemInterface $image, string $mime_type) {
+    try {
+      $info_json = $this->httpClient->get($iiif_url)->getBody();
+      $resource = json_decode($info_json, TRUE);
+      $width = $resource['width'];
+      $height = $resource['height'];
+    }
+    catch (ClientException | ServerException | ConnectException $e) {
+      // If we couldn't get the info.json from IIIF
+      // try seeing if we can get it from Drupal.
+      if (empty($width) || empty($height)) {
+        // Get the image properties so we know the image width/height.
+        $properties = $image->getProperties();
+        $width = isset($properties['width']) ? $properties['width'] : 0;
+        $height = isset($properties['height']) ? $properties['height'] : 0;
+
+        // If this is a TIFF AND we don't know the width/height
+        // see if we can get the image size via PHP's core function.
+        if ($mime_type === 'image/tiff' && !$width || !$height) {
+          $uri = $image->entity->getFileUri();
+          $path = $this->fileSystem->realpath($uri);
+          $image_size = getimagesize($path);
+          if ($image_size) {
+            $width = $image_size[0];
+            $height = $image_size[1];
+          }
+        }
+      }
+    }
+    return [$width, $height];
+  }
+
   /**
    * Pull a title from the node or media passed to this view.
    *
@@ -426,6 +448,15 @@ class IIIFManifest extends StylePluginBase {
       '#options' => $field_options,
       '#required' => FALSE,
     ];
+    $form['structured_text_term'] = [
+      '#type' => 'entity_autocomplete',
+      '#target_type' => 'taxonomy_term',
+      '#title' => $this->t('Structured text term'),
+      '#default_value' => $this->utils->getTermForUri($this->options['structured_text_term_uri']),
+      '#required' => FALSE,
+      '#description' => $this->t('Term indicating the media that holds structured text, such as hOCR, for the given object.'),
+    ];
+
   }
 
   /**
@@ -436,6 +467,15 @@ class IIIFManifest extends StylePluginBase {
    */
   public function getFormats() {
     return ['json' => 'json'];
+  }  
+
+  public function submitOptionsForm(&$form, FormStateInterface $form_state) {
+    $style_options = $form_state->getValue('style_options');
+    $tid = $style_options['structured_text_term'];
+    $term = $this->entityTypeManager->getStorage('taxonomy_term')->load($tid);
+    $style_options['structured_text_term_uri'] = $this->utils->getUriForTerm($term);
+    $form_state->setValue('style_options', $style_options);
+    parent::submitOptionsForm($form, $form_state);
   }
 
 }

From 9ef3bcf440255d54ebb63d57bf72c7ea0822c60f Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Thu, 8 Jun 2023 12:30:21 -0300
Subject: [PATCH 40/64] Refactor IIIF Manifest Views Style plugin.

---
 .../src/Plugin/views/style/IIIFManifest.php   | 70 ++++++++++++-------
 1 file changed, 44 insertions(+), 26 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 49c35208..9fde1ed7 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -3,8 +3,9 @@
 namespace Drupal\islandora_iiif\Plugin\views\style;
 
 use Drupal\Core\Config\ImmutableConfig;
-use Drupal\Core\File\FileSystemInterface;
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\File\FileSystemInterface;
 use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Messenger\MessengerInterface;
@@ -210,33 +211,9 @@ class IIIFManifest extends StylePluginBase {
     $canvases = [];
     foreach (array_filter(array_values($this->options['iiif_tile_field'])) as $iiif_tile_field) {
       $viewsField = $this->view->field[$iiif_tile_field];
-      $iiif_ocr_file_field = !empty($this->options['iiif_ocr_file_field']) ? array_filter(array_values($this->options['iiif_ocr_file_field'])) : [];
-      
-      $ocrField = count($iiif_ocr_file_field) > 0 ? $this->view->field[$iiif_ocr_file_field[0]] : NULL;
       $entity = $viewsField->getEntity($row);
 
-      if ($ocrField) {
-        $ocr_entity = $entity;
-        $ocr_field_name = $ocrField->definition['field_name'];
-        if (!is_null($ocrField_name)) {
-          $ocrs = $ocr_entity->{$ocr_field_name};
-          $ocr = isset($ocrs[$i]) ? $ocrs[$i] : FALSE;
-          $ocr_url = $ocr->entity->createFileUrl(FALSE);
-        }
-      }
-      else if ($structured_text_term) {
-        $parent_node = $this->utils->getParentNode($entity);
-        $ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term);
-        $ocr_entity_id = is_array($ocr_entity_array) ? array_shift($ocr_entity_array) : NULL;
-        $ocr_entity = $ocr_entity_id ? $this->entityTypeManager->getStorage('media')->load($ocr_entity_id) : NULL;
-        $ocr_file_source = $ocr_entity ? $ocr_entity->getSource() : NULL;
-        $ocr_fid = $ocr_file_source->getSourceFieldValue($ocr_entity);
-        $ocr_file = $this->entityTypeManager->getStorage('file')->load($ocr_fid);
-        $ocr_url = $ocr_file->createFileUrl(FALSE);
-      }
-
       if (isset($entity->{$viewsField->definition['field_name']})) {
-
         /** @var \Drupal\Core\Field\FieldItemListInterface $images */
         $images = $entity->{$viewsField->definition['field_name']};
         foreach ($images as $i => $image) {
@@ -287,7 +264,7 @@ class IIIFManifest extends StylePluginBase {
             ],
           ];
 
-          if ($ocr_url) {
+          if ($ocr_url = $this->getOcrUrl($entity, $structured_text_term)) {
             $tmp_canvas['seeAlso'] = [
               '@id' => $ocr_url,
               'format' => 'text/vnd.hocr+html',
@@ -348,6 +325,47 @@ class IIIFManifest extends StylePluginBase {
     return [$width, $height];
   }
 
+  /**
+   * Retrieves a URL text with positional data such as hOCR
+   * 
+   * @param EntityInterface $entity
+   *   The entity at the current row.
+   * @param \Drupal\taxonomy\TermInterface|null $structured_text_term
+   *   The term that structured text media references, if any.
+   
+   * return String|FALSE
+   *   The absolute URL of the current row's structured text, 
+   * or FALSE if none.
+   */
+  protected function getOcrUrl(EntityInterface $entity, $structured_text_term) {
+    $ocr_url = FALSE;
+    $iiif_ocr_file_field = !empty($this->options['iiif_ocr_file_field']) ? array_filter(array_values($this->options['iiif_ocr_file_field'])) : [];
+    $ocrField = count($iiif_ocr_file_field) > 0 ? $this->view->field[$iiif_ocr_file_field[0]] : NULL;
+    if ($ocrField) {
+      $ocr_entity = $entity;
+      $ocr_field_name = $ocrField->definition['field_name'];
+      if (!is_null($ocrField_name)) {
+        $ocrs = $ocr_entity->{$ocr_field_name};
+        $ocr = isset($ocrs[$i]) ? $ocrs[$i] : FALSE;
+        $ocr_url = $ocr->entity->createFileUrl(FALSE);
+      }
+    }
+    else if ($structured_text_term) {
+      $parent_node = $this->utils->getParentNode($entity);
+      $ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term);
+      $ocr_entity_id = is_array($ocr_entity_array) ? array_shift($ocr_entity_array) : NULL;
+      $ocr_entity = $ocr_entity_id ? $this->entityTypeManager->getStorage('media')->load($ocr_entity_id) : NULL;
+      if ($ocr_entity) {
+        $ocr_file_source = $ocr_entity->getSource();
+        $ocr_fid = $ocr_file_source->getSourceFieldValue($ocr_entity);
+        $ocr_file = $this->entityTypeManager->getStorage('file')->load($ocr_fid);
+        $ocr_url = $ocr_file->createFileUrl(FALSE);
+      }
+    }
+
+    return $ocr_url;
+  }
+
   /**
    * Pull a title from the node or media passed to this view.
    *

From 723f1023656f8c6858bee3599164f9d91f076f89 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Mon, 12 Jun 2023 20:11:14 -0300
Subject: [PATCH 41/64] Update Islandora IIIF README.

---
 modules/islandora_iiif/README.md | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/islandora_iiif/README.md b/modules/islandora_iiif/README.md
index ab06524b..a5cfc3b0 100644
--- a/modules/islandora_iiif/README.md
+++ b/modules/islandora_iiif/README.md
@@ -1,4 +1,4 @@
-# Islandora IIIF 
+# Islandora IIIF
 
 [![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg?style=flat-square)](https://php.net/)
 [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
@@ -11,7 +11,7 @@ Provides IIIF manifests using views.
 ## Requirements
 
 - `islandora` and `islandora_core_feature`
-- A IIIF image server (such as Cantaloupe) 
+- A IIIF image server (such as Cantaloupe)
 
 ## Installation
 
@@ -32,6 +32,14 @@ You can set the following configuration at `admin/config/islandora/iiif`:
 - IIIF Image server location
   - The URL to your IIIF image server (without trailing slash).
 
+### Views Style Plugin
+
+This module implements a Views Style plugin. It provides the following settings:
+
+1. Tile Source: A field that was added to the views list of fields with the image to be served. This should be a File or Image type field on a Media.
+2. Structured Text field: This lets you specify a file field on the same entity as above where OCR text with positional data, e.g., hOCR can be found.
+3. Structured Text term: The Islandora term with a Media Use URI where the structured OCR text can be found. This is another option to the above for storing this data in a separate media related to the parent node, rather than on the same media.
+
 ## Documentation
 
 Official documentation is available on the [Islandora 8 documentation site](https://islandora.github.io/documentation/).

From 7527b1fa6fadda346709a0d6850b983cad8d7802 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Mon, 12 Jun 2023 21:13:00 -0300
Subject: [PATCH 42/64] Address PHPCS errors.

---
 .../src/Plugin/views/style/IIIFManifest.php   | 38 ++++++++++++-------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 9fde1ed7..7bbe03dd 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -35,7 +35,7 @@ use Symfony\Component\HttpFoundation\Request;
  */
 class IIIFManifest extends StylePluginBase {
 
-/**
+  /**
    * Islandora utility functions.
    *
    * @var \Drupal\islandora\IslandoraUtils
@@ -233,7 +233,7 @@ class IIIFManifest extends StylePluginBase {
           $annotation_id = $iiif_base_id . '/annotation/' . $entity->id();
 
           [$width, $height] = $this->getCanvasDimensions($iiif_url, $image, $mime_type);
-          
+
           $tmp_canvas = [
             // @see https://iiif.io/api/presentation/2.1/#canvas
             '@id' => $canvas_id,
@@ -283,13 +283,14 @@ class IIIFManifest extends StylePluginBase {
 
   /**
    * Try to fetch the IIIF metadata for the image.
-   * 
+   *
    * @param string $iiif_url
-   *   Base URL of the canvas
-   * @param FieldItemInterface $image
+   *   Base URL of the canvas.
+   * @param \Drupal\Core\Field\FieldItemInterface $image
    *   The image field.
    * @param string $mime_type
    *   The mime type of the image.
+   *
    * @return [string]
    *   The width and height of the image.
    */
@@ -326,16 +327,16 @@ class IIIFManifest extends StylePluginBase {
   }
 
   /**
-   * Retrieves a URL text with positional data such as hOCR
-   * 
-   * @param EntityInterface $entity
+   * Retrieves a URL text with positional data such as hOCR.
+   *
+   * @param \Drupal\Core\Entity\EntityInterface $entity
    *   The entity at the current row.
    * @param \Drupal\taxonomy\TermInterface|null $structured_text_term
    *   The term that structured text media references, if any.
-   
+  *
    * return String|FALSE
-   *   The absolute URL of the current row's structured text, 
-   * or FALSE if none.
+   *   The absolute URL of the current row's structured text,
+   *   or FALSE if none.
    */
   protected function getOcrUrl(EntityInterface $entity, $structured_text_term) {
     $ocr_url = FALSE;
@@ -350,7 +351,7 @@ class IIIFManifest extends StylePluginBase {
         $ocr_url = $ocr->entity->createFileUrl(FALSE);
       }
     }
-    else if ($structured_text_term) {
+    elseif ($structured_text_term) {
       $parent_node = $this->utils->getParentNode($entity);
       $ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term);
       $ocr_entity_id = is_array($ocr_entity_array) ? array_shift($ocr_entity_array) : NULL;
@@ -485,8 +486,19 @@ class IIIFManifest extends StylePluginBase {
    */
   public function getFormats() {
     return ['json' => 'json'];
-  }  
+  }
 
+  /**
+   * Submit handler for options form.
+   * Used to store the structured text media term by URL instead of Ttid.
+   *
+   * @param array $form
+   * The form.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   * The form state object.
+   *
+   * @return void
+   */
   public function submitOptionsForm(&$form, FormStateInterface $form_state) {
     $style_options = $form_state->getValue('style_options');
     $tid = $style_options['structured_text_term'];

From f41dc59f1bd08e698bf266d913042d19178f032c Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Tue, 13 Jun 2023 22:10:12 -0300
Subject: [PATCH 43/64] Remove term-based hOCR configuration since we can just
 use Views.

---
 modules/islandora_iiif/README.md              |  4 +-
 .../src/Plugin/views/style/IIIFManifest.php   | 69 +++----------------
 2 files changed, 11 insertions(+), 62 deletions(-)

diff --git a/modules/islandora_iiif/README.md b/modules/islandora_iiif/README.md
index a5cfc3b0..c1f89872 100644
--- a/modules/islandora_iiif/README.md
+++ b/modules/islandora_iiif/README.md
@@ -37,9 +37,7 @@ You can set the following configuration at `admin/config/islandora/iiif`:
 This module implements a Views Style plugin. It provides the following settings:
 
 1. Tile Source: A field that was added to the views list of fields with the image to be served. This should be a File or Image type field on a Media.
-2. Structured Text field: This lets you specify a file field on the same entity as above where OCR text with positional data, e.g., hOCR can be found.
-3. Structured Text term: The Islandora term with a Media Use URI where the structured OCR text can be found. This is another option to the above for storing this data in a separate media related to the parent node, rather than on the same media.
-
+2. Structured Text field: This lets you specify a file field   where OCR text with positional data, e.g., hOCR can be found.
 ## Documentation
 
 Official documentation is available on the [Islandora 8 documentation site](https://islandora.github.io/documentation/).
diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 7bbe03dd..a745e1f7 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -154,11 +154,6 @@ class IIIFManifest extends StylePluginBase {
       $content_path = implode('/', $url_components);
       $iiif_base_id = $request_host . '/' . $content_path;
 
-      /**
-       * @var \Drupal\taxonomy\TermInterface|null
-       */
-      $structured_text_term = $this->utils->getTermForUri($this->options['structured_text_term_uri']);
-
       // @see https://iiif.io/api/presentation/2.1/#manifest
       $json += [
         '@type' => 'sc:Manifest',
@@ -178,7 +173,7 @@ class IIIFManifest extends StylePluginBase {
       // For each row in the View result.
       foreach ($this->view->result as $row) {
         // Add the IIIF URL to the image to print out as JSON.
-        $canvases = $this->getTileSourceFromRow($row, $iiif_address, $iiif_base_id, $structured_text_term);
+        $canvases = $this->getTileSourceFromRow($row, $iiif_address, $iiif_base_id);
         foreach ($canvases as $tile_source) {
           $json['sequences'][0]['canvases'][] = $tile_source;
         }
@@ -201,13 +196,11 @@ class IIIFManifest extends StylePluginBase {
    * @param string $iiif_base_id
    *   The URL for the request, minus the last part of the URL,
    *   which is likely "manifest".
-   * @param \Drupal\taxonomy\TermInterface|null $structured_text_term
-   *   The term that structured text media references, if any.
    *
    * @return array
    *   List of IIIF URLs to display in the Openseadragon viewer.
    */
-  protected function getTileSourceFromRow(ResultRow $row, $iiif_address, $iiif_base_id, $structured_text_term) {
+  protected function getTileSourceFromRow(ResultRow $row, $iiif_address, $iiif_base_id) {
     $canvases = [];
     foreach (array_filter(array_values($this->options['iiif_tile_field'])) as $iiif_tile_field) {
       $viewsField = $this->view->field[$iiif_tile_field];
@@ -264,7 +257,7 @@ class IIIFManifest extends StylePluginBase {
             ],
           ];
 
-          if ($ocr_url = $this->getOcrUrl($entity, $structured_text_term)) {
+          if ($ocr_url = $this->getOcrUrl($entity, $row, $i)) {
             $tmp_canvas['seeAlso'] = [
               '@id' => $ocr_url,
               'format' => 'text/vnd.hocr+html',
@@ -331,36 +324,24 @@ class IIIFManifest extends StylePluginBase {
    *
    * @param \Drupal\Core\Entity\EntityInterface $entity
    *   The entity at the current row.
-   * @param \Drupal\taxonomy\TermInterface|null $structured_text_term
-   *   The term that structured text media references, if any.
   *
    * return String|FALSE
    *   The absolute URL of the current row's structured text,
    *   or FALSE if none.
    */
-  protected function getOcrUrl(EntityInterface $entity, $structured_text_term) {
+  protected function getOcrUrl(EntityInterface $entity, $row, $delta) {
     $ocr_url = FALSE;
     $iiif_ocr_file_field = !empty($this->options['iiif_ocr_file_field']) ? array_filter(array_values($this->options['iiif_ocr_file_field'])) : [];
     $ocrField = count($iiif_ocr_file_field) > 0 ? $this->view->field[$iiif_ocr_file_field[0]] : NULL;
     if ($ocrField) {
-      $ocr_entity = $entity;
+      $ocr_entity = $ocrField->getEntity($row);
       $ocr_field_name = $ocrField->definition['field_name'];
-      if (!is_null($ocrField_name)) {
+      if (!is_null($ocr_field_name)) {
         $ocrs = $ocr_entity->{$ocr_field_name};
-        $ocr = isset($ocrs[$i]) ? $ocrs[$i] : FALSE;
-        $ocr_url = $ocr->entity->createFileUrl(FALSE);
-      }
-    }
-    elseif ($structured_text_term) {
-      $parent_node = $this->utils->getParentNode($entity);
-      $ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term);
-      $ocr_entity_id = is_array($ocr_entity_array) ? array_shift($ocr_entity_array) : NULL;
-      $ocr_entity = $ocr_entity_id ? $this->entityTypeManager->getStorage('media')->load($ocr_entity_id) : NULL;
-      if ($ocr_entity) {
-        $ocr_file_source = $ocr_entity->getSource();
-        $ocr_fid = $ocr_file_source->getSourceFieldValue($ocr_entity);
-        $ocr_file = $this->entityTypeManager->getStorage('file')->load($ocr_fid);
-        $ocr_url = $ocr_file->createFileUrl(FALSE);
+        $ocr = isset($ocrs[$delta]) ? $ocrs[$delta] : FALSE;
+        if ($ocr) {
+          $ocr_url = $ocr->entity->createFileUrl(FALSE);
+        }
       }
     }
 
@@ -467,15 +448,6 @@ class IIIFManifest extends StylePluginBase {
       '#options' => $field_options,
       '#required' => FALSE,
     ];
-    $form['structured_text_term'] = [
-      '#type' => 'entity_autocomplete',
-      '#target_type' => 'taxonomy_term',
-      '#title' => $this->t('Structured text term'),
-      '#default_value' => $this->utils->getTermForUri($this->options['structured_text_term_uri']),
-      '#required' => FALSE,
-      '#description' => $this->t('Term indicating the media that holds structured text, such as hOCR, for the given object.'),
-    ];
-
   }
 
   /**
@@ -487,25 +459,4 @@ class IIIFManifest extends StylePluginBase {
   public function getFormats() {
     return ['json' => 'json'];
   }
-
-  /**
-   * Submit handler for options form.
-   * Used to store the structured text media term by URL instead of Ttid.
-   *
-   * @param array $form
-   * The form.
-   * @param \Drupal\Core\Form\FormStateInterface $form_state
-   * The form state object.
-   *
-   * @return void
-   */
-  public function submitOptionsForm(&$form, FormStateInterface $form_state) {
-    $style_options = $form_state->getValue('style_options');
-    $tid = $style_options['structured_text_term'];
-    $term = $this->entityTypeManager->getStorage('taxonomy_term')->load($tid);
-    $style_options['structured_text_term_uri'] = $this->utils->getUriForTerm($term);
-    $form_state->setValue('style_options', $style_options);
-    parent::submitOptionsForm($form, $form_state);
-  }
-
 }

From cf243f368d013bda19e519d99dd49b54c11c2a4e Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Tue, 13 Jun 2023 22:38:45 -0300
Subject: [PATCH 44/64] Fix PHPCS errors.

---
 .../islandora_iiif/src/Plugin/views/style/IIIFManifest.php   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index a745e1f7..8527067d 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -324,8 +324,10 @@ class IIIFManifest extends StylePluginBase {
    *
    * @param \Drupal\Core\Entity\EntityInterface $entity
    *   The entity at the current row.
+  * @param int $delta
+  *.  The delta in case there are multiple canvases on one media.
   *
-   * return String|FALSE
+   * @return String|FALSE
    *   The absolute URL of the current row's structured text,
    *   or FALSE if none.
    */
@@ -459,4 +461,5 @@ class IIIFManifest extends StylePluginBase {
   public function getFormats() {
     return ['json' => 'json'];
   }
+
 }

From 9f5eceea072f5ee79aabb404bf904362fa2821b0 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Tue, 13 Jun 2023 22:57:51 -0300
Subject: [PATCH 45/64] Fix PHPCS errors.

---
 .../src/Plugin/views/style/IIIFManifest.php           | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 8527067d..2dfce979 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -324,14 +324,15 @@ class IIIFManifest extends StylePluginBase {
    *
    * @param \Drupal\Core\Entity\EntityInterface $entity
    *   The entity at the current row.
-  * @param int $delta
-  *.  The delta in case there are multiple canvases on one media.
-  *
-   * @return String|FALSE
+   *  @param \Drupal\views\ResultRow $row
+   *   Result row.  * @param int $delta
+   *   The delta in case there are multiple canvases on one media.
+   *
+   * @return string|false
    *   The absolute URL of the current row's structured text,
    *   or FALSE if none.
    */
-  protected function getOcrUrl(EntityInterface $entity, $row, $delta) {
+  protected function getOcrUrl(EntityInterface $entity, ResultRow $row, $delta) {
     $ocr_url = FALSE;
     $iiif_ocr_file_field = !empty($this->options['iiif_ocr_file_field']) ? array_filter(array_values($this->options['iiif_ocr_file_field'])) : [];
     $ocrField = count($iiif_ocr_file_field) > 0 ? $this->view->field[$iiif_ocr_file_field[0]] : NULL;

From d4cac7299314436b5a5664ba91ed874b45180a31 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Wed, 14 Jun 2023 09:06:19 -0300
Subject: [PATCH 46/64] Fix PHPCS errors.

---
 .../islandora_iiif/src/Plugin/views/style/IIIFManifest.php   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 2dfce979..e52f59f9 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -324,8 +324,9 @@ class IIIFManifest extends StylePluginBase {
    *
    * @param \Drupal\Core\Entity\EntityInterface $entity
    *   The entity at the current row.
-   *  @param \Drupal\views\ResultRow $row
-   *   Result row.  * @param int $delta
+   * @param \Drupal\views\ResultRow $row
+   *   Result row.
+   * @param int $delta
    *   The delta in case there are multiple canvases on one media.
    *
    * @return string|false

From e492b92d9f22199289d9663c841f8642fc439741 Mon Sep 17 00:00:00 2001
From: Alexander O'Neill <alexander@born-digital.com>
Date: Thu, 15 Jun 2023 08:56:20 -0300
Subject: [PATCH 47/64] Remove Islandora Utils from Islandora IIIF.

---
 .../src/Plugin/views/style/IIIFManifest.php       | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index e52f59f9..63f015d1 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -10,7 +10,6 @@ use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Messenger\MessengerInterface;
 use Drupal\Core\Url;
-use Drupal\islandora\IslandoraUtils;
 use Drupal\views\Plugin\views\style\StylePluginBase;
 use Drupal\views\ResultRow;
 use GuzzleHttp\Client;
@@ -35,13 +34,6 @@ use Symfony\Component\HttpFoundation\Request;
  */
 class IIIFManifest extends StylePluginBase {
 
-  /**
-   * Islandora utility functions.
-   *
-   * @var \Drupal\islandora\IslandoraUtils
-   */
-  protected $utils;
-
   /**
    * {@inheritdoc}
    */
@@ -104,7 +96,7 @@ class IIIFManifest extends StylePluginBase {
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger, IslandoraUtils $utils) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
 
     $this->serializer = $serializer;
@@ -114,8 +106,6 @@ class IIIFManifest extends StylePluginBase {
     $this->fileSystem = $file_system;
     $this->httpClient = $http_client;
     $this->messenger = $messenger;
-    $this->utils = $utils;
-
   }
 
   /**
@@ -132,8 +122,7 @@ class IIIFManifest extends StylePluginBase {
       $container->get('entity_type.manager'),
       $container->get('file_system'),
       $container->get('http_client'),
-      $container->get('messenger'),
-      $container->get('islandora.utils')
+      $container->get('messenger')
     );
   }
 

From 91490ddbe21d9f79fcde716e87b6007c3ad51f53 Mon Sep 17 00:00:00 2001
From: Seth Shaw <108362375+seth-shaw-asu@users.noreply.github.com>
Date: Mon, 19 Jun 2023 09:49:41 -0700
Subject: [PATCH 48/64] bump jwt version (#952)

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index 3ceed0e1..bf274cd1 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,7 @@
     "drupal/file_replace": "^1.1",
     "drupal/filehash": "^2",
     "drupal/flysystem" : "^2.0@alpha",
-    "drupal/jwt": "^1.1",
+    "drupal/jwt": "^1.1 || ^2",
     "drupal/migrate_plus" : "^5.1 || ^6",
     "drupal/migrate_source_csv" : "^3.4",
     "drupal/prepopulate" : "^2.2",

From 7d7f97746abaa22156da0cc7dd17427d56e1ff0c Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Fri, 26 May 2023 16:41:10 -0300
Subject: [PATCH 49/64] Drupal Rector.

---
 .../Functional/GenerateAudioDerivativeTest.php  |  3 ++-
 .../tests/src/Functional/BreadcrumbsTest.php    |  4 ++--
 .../Functional/GenerateImageDerivativeTest.php  |  3 ++-
 .../src/Controller/MediaSourceController.php    |  2 +-
 .../tests/src/Functional/LoadTest.php           |  4 ++--
 .../Functional/GenerateVideoDerivativeTest.php  |  3 ++-
 src/EventSubscriber/LinkHeaderSubscriber.php    |  6 +++---
 .../MediaLinkHeaderSubscriber.php               |  4 ++--
 .../NodeLinkHeaderSubscriber.php                |  6 +++---
 src/Flysystem/Adapter/FedoraAdapter.php         | 14 ++++++++------
 .../AbstractFileSelectionForm.php               |  7 ++++++-
 tests/src/Functional/AddChildTest.php           |  2 +-
 tests/src/Functional/AddMediaToNodeTest.php     |  2 +-
 tests/src/Functional/ContentEntityTypeTest.php  |  3 ++-
 tests/src/Functional/DeleteMediaTest.php        |  4 ++--
 tests/src/Functional/DerivativeReactionTest.php |  5 +++--
 .../Functional/GenerateDerivativeTestBase.php   |  2 +-
 tests/src/Functional/IndexingTest.php           |  5 +++--
 .../Functional/IslandoraFunctionalTestBase.php  | 11 +++++++----
 .../Functional/IslandoraImageFormatterTest.php  |  2 +-
 .../Functional/IslandoraSettingsFormTest.php    | 17 +++++++++++------
 .../JsonldSelfReferenceReactionTest.php         | 13 +++++++------
 .../Functional/JsonldTypeAlterReactionTest.php  | 14 ++++++++------
 tests/src/Functional/LinkHeaderTest.php         |  2 +-
 tests/src/Functional/MediaSourceUpdateTest.php  |  2 +-
 tests/src/Functional/NodeHasTermTest.php        |  2 +-
 .../Functional/ViewModeAlterReactionTest.php    |  2 +-
 .../FunctionalJavascript/IntegerWeightTest.php  |  2 +-
 tests/src/Kernel/EventGeneratorTest.php         |  2 +-
 tests/src/Kernel/FedoraAdapterTest.php          | 12 ++++++++----
 tests/src/Kernel/IslandoraKernelTestBase.php    |  4 ++--
 tests/src/Kernel/JwtEventSubscriberTest.php     |  4 +++-
 32 files changed, 99 insertions(+), 69 deletions(-)

diff --git a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
index fc1c6188..766ceac0 100644
--- a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
+++ b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
@@ -68,7 +68,8 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
       'field_media_of[0][target_id]' => 'Test Node',
       'field_tags[0][target_id]' => 'Preservation Master',
     ];
-    $this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
+    $this->drupalGet('media/add/' . $this->testMediaType->id());
+    $this->submitForm($values, $this->t('Save'));
 
     $expected = [
       'source_uri' => 'test_file.txt',
diff --git a/modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php b/modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php
index 80f5dbee..ee35a1ed 100644
--- a/modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php
+++ b/modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php
@@ -20,7 +20,7 @@ class BreadcrumbsTest extends IslandoraFunctionalTestBase {
    *
    * @var array
    */
-  public static $modules = [
+  protected static $modules = [
     'islandora_breadcrumbs',
   ];
 
@@ -56,7 +56,7 @@ class BreadcrumbsTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Create some nodes.
diff --git a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
index b6e016fc..295eae91 100644
--- a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
+++ b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
@@ -70,7 +70,8 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
       'field_media_of[0][target_id]' => 'Test Node',
       'field_tags[0][target_id]' => 'Preservation Master',
     ];
-    $this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
+    $this->drupalGet('media/add/' . $this->testMediaType->id());
+    $this->submitForm($values, $this->t('Save'));
 
     $expected = [
       'source_uri' => 'test_file.txt',
diff --git a/modules/islandora_text_extraction/src/Controller/MediaSourceController.php b/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
index f15e42d5..5518220d 100644
--- a/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
+++ b/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
@@ -98,7 +98,7 @@ class MediaSourceController extends ControllerBase {
       if (!$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
         throw new HttpException(500, "The destination directory does not exist, could not be created, or is not writable");
       }
-      $file = file_save_data($contents, $content_location, FileSystemInterface::EXISTS_REPLACE);
+      $file = \Drupal::service('file.repository')->writeData($contents, $content_location, FileSystemInterface::EXISTS_REPLACE);
       if ($media->hasField($destination_field)) {
         $media->{$destination_field}->setValue([
           'target_id' => $file->id(),
diff --git a/modules/islandora_text_extraction/tests/src/Functional/LoadTest.php b/modules/islandora_text_extraction/tests/src/Functional/LoadTest.php
index 31dca62c..172ae73a 100644
--- a/modules/islandora_text_extraction/tests/src/Functional/LoadTest.php
+++ b/modules/islandora_text_extraction/tests/src/Functional/LoadTest.php
@@ -17,7 +17,7 @@ class LoadTest extends IslandoraFunctionalTestBase {
    *
    * @var array
    */
-  public static $modules = ['islandora_text_extraction'];
+  protected static $modules = ['islandora_text_extraction'];
 
   /**
    * A user with permission to administer site configuration.
@@ -29,7 +29,7 @@ class LoadTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->user = $this->drupalCreateUser(['administer site configuration']);
     $this->drupalLogin($this->user);
diff --git a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
index 8714a2f1..17e8bd5b 100644
--- a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
+++ b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
@@ -65,7 +65,8 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
       'field_media_of[0][target_id]' => 'Test Node',
       'field_tags[0][target_id]' => 'Preservation Master',
     ];
-    $this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
+    $this->drupalGet('media/add/' . $this->testMediaType->id());
+    $this->submitForm($values, $this->t('Save'));
 
     $expected = [
       'source_uri' => 'test_file.txt',
diff --git a/src/EventSubscriber/LinkHeaderSubscriber.php b/src/EventSubscriber/LinkHeaderSubscriber.php
index ce33ce2e..f7e5725b 100644
--- a/src/EventSubscriber/LinkHeaderSubscriber.php
+++ b/src/EventSubscriber/LinkHeaderSubscriber.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\islandora\EventSubscriber;
 
+use Symfony\Component\HttpKernel\Event\ResponseEvent;
 use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Entity\EntityFieldManagerInterface;
 use Drupal\Core\Entity\EntityInterface;
@@ -13,7 +14,6 @@ use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
 use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
 use Symfony\Component\HttpKernel\KernelEvents;
 
 /**
@@ -312,9 +312,9 @@ abstract class LinkHeaderSubscriber implements EventSubscriberInterface {
   /**
    * Adds resource-specific link headers to appropriate responses.
    *
-   * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
+   * @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event
    *   Event containing the response.
    */
-  abstract public function onResponse(FilterResponseEvent $event);
+  abstract public function onResponse(ResponseEvent $event);
 
 }
diff --git a/src/EventSubscriber/MediaLinkHeaderSubscriber.php b/src/EventSubscriber/MediaLinkHeaderSubscriber.php
index 3cebbbaa..0f406cf5 100644
--- a/src/EventSubscriber/MediaLinkHeaderSubscriber.php
+++ b/src/EventSubscriber/MediaLinkHeaderSubscriber.php
@@ -2,10 +2,10 @@
 
 namespace Drupal\islandora\EventSubscriber;
 
+use Symfony\Component\HttpKernel\Event\ResponseEvent;
 use Drupal\Core\Url;
 use Drupal\media\MediaInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
 
 /**
  * Subscribes to MediaLinkHeader Event.
@@ -17,7 +17,7 @@ class MediaLinkHeaderSubscriber extends LinkHeaderSubscriber implements EventSub
   /**
    * {@inheritdoc}
    */
-  public function onResponse(FilterResponseEvent $event) {
+  public function onResponse(ResponseEvent $event) {
     $response = $event->getResponse();
 
     $media = $this->getObject($response, 'media');
diff --git a/src/EventSubscriber/NodeLinkHeaderSubscriber.php b/src/EventSubscriber/NodeLinkHeaderSubscriber.php
index e00533f7..c4cdaea8 100644
--- a/src/EventSubscriber/NodeLinkHeaderSubscriber.php
+++ b/src/EventSubscriber/NodeLinkHeaderSubscriber.php
@@ -2,9 +2,9 @@
 
 namespace Drupal\islandora\EventSubscriber;
 
+use Symfony\Component\HttpKernel\Event\ResponseEvent;
 use Drupal\node\NodeInterface;
 use Drupal\islandora\IslandoraUtils;
-use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 
 /**
@@ -17,10 +17,10 @@ class NodeLinkHeaderSubscriber extends LinkHeaderSubscriber implements EventSubs
   /**
    * Adds node-specific link headers to appropriate responses.
    *
-   * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
+   * @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event
    *   Event containing the response.
    */
-  public function onResponse(FilterResponseEvent $event) {
+  public function onResponse(ResponseEvent $event) {
     $response = $event->getResponse();
 
     $node = $this->getObject($response, 'node');
diff --git a/src/Flysystem/Adapter/FedoraAdapter.php b/src/Flysystem/Adapter/FedoraAdapter.php
index 4ebc61c5..55f8b11d 100644
--- a/src/Flysystem/Adapter/FedoraAdapter.php
+++ b/src/Flysystem/Adapter/FedoraAdapter.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\islandora\Flysystem\Adapter;
 
+use GuzzleHttp\Psr7\Header;
+use function GuzzleHttp\Psr7\parse_header;
 use Drupal\Core\Logger\LoggerChannelInterface;
 use Islandora\Chullo\IFedoraApi;
 use League\Flysystem\AdapterInterface;
@@ -159,11 +161,11 @@ class FedoraAdapter implements AdapterInterface {
     // directory.
     $type = 'dir';
     // phpcs:disable
-    if (class_exists(\GuzzleHttp\Psr7\Header::class)) {
-      $links = \GuzzleHttp\Psr7\Header::parse($response->getHeader('Link'));
+    if (class_exists(Header::class)) {
+      $links = Header::parse($response->getHeader('Link'));
     }
     else {
-      $links = \GuzzleHttp\Psr7\parse_header($response->getHeader('Link'));
+      $links = parse_header($response->getHeader('Link'));
     }
     // phpcs:enable
     foreach ($links as $link) {
@@ -402,11 +404,11 @@ class FedoraAdapter implements AdapterInterface {
     if ($response->getStatusCode() == 410) {
       $return = FALSE;
       // phpcs:disable
-      if (class_exists(\GuzzleHttp\Psr7\Header::class)) {
-        $link_headers = \GuzzleHttp\Psr7\Header::parse($response->getHeader('Link'));
+      if (class_exists(Header::class)) {
+        $link_headers = Header::parse($response->getHeader('Link'));
       }
       else {
-        $link_headers = \GuzzleHttp\Psr7\parse_header($response->getHeader('Link'));
+        $link_headers = parse_header($response->getHeader('Link'));
       }
       // phpcs:enable
       if ($link_headers) {
diff --git a/src/Form/AddChildrenWizard/AbstractFileSelectionForm.php b/src/Form/AddChildrenWizard/AbstractFileSelectionForm.php
index 6aeed879..cf6ef305 100644
--- a/src/Form/AddChildrenWizard/AbstractFileSelectionForm.php
+++ b/src/Form/AddChildrenWizard/AbstractFileSelectionForm.php
@@ -37,6 +37,11 @@ abstract class AbstractFileSelectionForm extends FormBase {
    * @var \Drupal\islandora\Form\AddChildrenWizard\AbstractBatchProcessor|null
    */
   protected ?AbstractBatchProcessor $batchProcessor;
+  private \static $static;
+  public function __construct(\static $static)
+  {
+      $this->static = $static;
+  }
 
   /**
    * {@inheritdoc}
@@ -49,7 +54,7 @@ abstract class AbstractFileSelectionForm extends FormBase {
     $instance->entityFieldManager = $container->get('entity_field.manager');
     $instance->currentUser = $container->get('current_user');
 
-    $instance->batchProcessor = $container->get(static::BATCH_PROCESSOR);
+    $instance->batchProcessor = $this->static;
 
     return $instance;
   }
diff --git a/tests/src/Functional/AddChildTest.php b/tests/src/Functional/AddChildTest.php
index 9fc2f9e2..f27f9db9 100644
--- a/tests/src/Functional/AddChildTest.php
+++ b/tests/src/Functional/AddChildTest.php
@@ -12,7 +12,7 @@ class AddChildTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->parent =
diff --git a/tests/src/Functional/AddMediaToNodeTest.php b/tests/src/Functional/AddMediaToNodeTest.php
index 32909775..4b0b62c5 100644
--- a/tests/src/Functional/AddMediaToNodeTest.php
+++ b/tests/src/Functional/AddMediaToNodeTest.php
@@ -31,7 +31,7 @@ class AddMediaToNodeTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->node = $this->container->get('entity_type.manager')->getStorage('node')->create([
diff --git a/tests/src/Functional/ContentEntityTypeTest.php b/tests/src/Functional/ContentEntityTypeTest.php
index 362ff7fb..5ed22948 100644
--- a/tests/src/Functional/ContentEntityTypeTest.php
+++ b/tests/src/Functional/ContentEntityTypeTest.php
@@ -52,7 +52,8 @@ class ContentEntityTypeTest extends IslandoraFunctionalTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
     ];
-    $this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
+    $this->drupalGet('media/add/' . $this->testMediaType->id());
+    $this->submitForm($values, $this->t('Save'));
     $this->assertSession()->pageTextNotContains("Hello World!");
   }
 
diff --git a/tests/src/Functional/DeleteMediaTest.php b/tests/src/Functional/DeleteMediaTest.php
index f112c700..86895dbb 100644
--- a/tests/src/Functional/DeleteMediaTest.php
+++ b/tests/src/Functional/DeleteMediaTest.php
@@ -16,7 +16,7 @@ class DeleteMediaTest extends IslandoraFunctionalTestBase {
    *
    * @var array
    */
-  public static $modules = [
+  protected static $modules = [
     'media_test_views',
     'context_ui',
     'field_ui',
@@ -47,7 +47,7 @@ class DeleteMediaTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Create a test user.
diff --git a/tests/src/Functional/DerivativeReactionTest.php b/tests/src/Functional/DerivativeReactionTest.php
index e1b1c827..00e0e5ae 100644
--- a/tests/src/Functional/DerivativeReactionTest.php
+++ b/tests/src/Functional/DerivativeReactionTest.php
@@ -19,7 +19,7 @@ class DerivativeReactionTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->node = $this->container->get('entity_type.manager')->getStorage('node')->create([
@@ -52,7 +52,8 @@ class DerivativeReactionTest extends IslandoraFunctionalTestBase {
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
     ];
-    $this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
+    $this->drupalGet('media/add/' . $this->testMediaType->id());
+    $this->submitForm($values, $this->t('Save'));
 
     // field_media_of is set and there's a file, so derivatives should fire.
     $this->assertSession()->pageTextContains("Hello World!");
diff --git a/tests/src/Functional/GenerateDerivativeTestBase.php b/tests/src/Functional/GenerateDerivativeTestBase.php
index 0f67d591..c5ec9701 100644
--- a/tests/src/Functional/GenerateDerivativeTestBase.php
+++ b/tests/src/Functional/GenerateDerivativeTestBase.php
@@ -29,7 +29,7 @@ abstract class GenerateDerivativeTestBase extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->createUserAndLogin();
diff --git a/tests/src/Functional/IndexingTest.php b/tests/src/Functional/IndexingTest.php
index e995329d..ff215281 100644
--- a/tests/src/Functional/IndexingTest.php
+++ b/tests/src/Functional/IndexingTest.php
@@ -12,7 +12,7 @@ class IndexingTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Create an action that dsm's "Goodbye, Cruel World!".
@@ -63,9 +63,10 @@ class IndexingTest extends IslandoraFunctionalTestBase {
 
     // Add the Goodbye World reaction.
     $this->addPresetReaction('test', 'delete', 'goodbye_world');
+    $this->drupalGet("$url/delete");
 
     // Delete the node.
-    $this->drupalPostForm("$url/delete", [], $this->t('Delete'));
+    $this->submitForm([], $this->t('Delete'));
     $this->assertSession()->statusCodeEquals(200);
 
     // Confirm Goodbye, Cruel World! is printed to the screen.
diff --git a/tests/src/Functional/IslandoraFunctionalTestBase.php b/tests/src/Functional/IslandoraFunctionalTestBase.php
index 2e4c88e8..2e723561 100644
--- a/tests/src/Functional/IslandoraFunctionalTestBase.php
+++ b/tests/src/Functional/IslandoraFunctionalTestBase.php
@@ -88,7 +88,7 @@ class IslandoraFunctionalTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Delete the node rest config that's bootstrapped with Drupal.
@@ -314,7 +314,8 @@ EOD;
    * Create a new node by posting its add form.
    */
   protected function postNodeAddForm($bundle_id, $values, $button_text) {
-    $this->drupalPostForm("node/add/$bundle_id", $values, $this->t('@text', ['@text' => $button_text]));
+    $this->drupalGet("node/add/$bundle_id");
+    $this->submitForm($values, $this->t('@text', ['@text' => $button_text]));
     $this->assertSession()->statusCodeEquals(200);
   }
 
@@ -322,7 +323,8 @@ EOD;
    * Create a new node by posting its add form.
    */
   protected function postTermAddForm($taxomony_id, $values, $button_text) {
-    $this->drupalPostForm("admin/structure/taxonomy/manage/$taxomony_id/add", $values, $this->t('@text', ['@text' => $button_text]));
+    $this->drupalGet("admin/structure/taxonomy/manage/$taxomony_id/add");
+    $this->submitForm($values, $this->t('@text', ['@text' => $button_text]));
     $this->assertSession()->statusCodeEquals(200);
   }
 
@@ -330,7 +332,8 @@ EOD;
    * Edits a node by posting its edit form.
    */
   protected function postEntityEditForm($entity_url, $values, $button_text) {
-    $this->drupalPostForm("$entity_url/edit", $values, $this->t('@text', ['@text' => $button_text]));
+    $this->drupalGet("$entity_url/edit");
+    $this->submitForm($values, $this->t('@text', ['@text' => $button_text]));
     $this->assertSession()->statusCodeEquals(200);
   }
 
diff --git a/tests/src/Functional/IslandoraImageFormatterTest.php b/tests/src/Functional/IslandoraImageFormatterTest.php
index 33f6e1e6..84ea5517 100644
--- a/tests/src/Functional/IslandoraImageFormatterTest.php
+++ b/tests/src/Functional/IslandoraImageFormatterTest.php
@@ -92,7 +92,7 @@ class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase {
         ':title' => 'Some Title',
       ]
     );
-    $this->assertEqual(count($elements), 1, 'Image linked to content formatter displaying points to Node and not Media.');
+    $this->assertEquals(count($elements), 1, 'Image linked to content formatter displaying points to Node and not Media.');
   }
 
 }
diff --git a/tests/src/Functional/IslandoraSettingsFormTest.php b/tests/src/Functional/IslandoraSettingsFormTest.php
index 92cfc6a2..80a327af 100644
--- a/tests/src/Functional/IslandoraSettingsFormTest.php
+++ b/tests/src/Functional/IslandoraSettingsFormTest.php
@@ -14,7 +14,7 @@ class IslandoraSettingsFormTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Create a test user.
@@ -36,20 +36,25 @@ class IslandoraSettingsFormTest extends IslandoraFunctionalTestBase {
     $this->assertSession()->statusCodeEquals(200);
     $this->assertSession()->pageTextContains("JWT Expiry");
     $this->assertSession()->fieldValueEquals('edit-jwt-expiry', '+2 hour');
+    $this->drupalGet('/admin/config/islandora/core');
     // Blank is not allowed.
-    $this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => ""], $this->t('Save configuration'));
+    $this->submitForm(['edit-jwt-expiry' => ""], $this->t('Save configuration'));
     $this->assertSession()->pageTextContainsOnce('"" is not a valid time or interval expression.');
+    $this->drupalGet('/admin/config/islandora/core');
     // Negative is not allowed.
-    $this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => "-2 hours"], $this->t('Save configuration'));
+    $this->submitForm(['edit-jwt-expiry' => "-2 hours"], $this->t('Save configuration'));
     $this->assertSession()->pageTextContainsOnce('Time or interval expression cannot be negative');
+    $this->drupalGet('/admin/config/islandora/core');
     // Must include an integer value.
-    $this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => "last hour"], $this->t('Save configuration'));
+    $this->submitForm(['edit-jwt-expiry' => "last hour"], $this->t('Save configuration'));
     $this->assertSession()->pageTextContainsOnce('No numeric interval specified, for example "1 day"');
+    $this->drupalGet('/admin/config/islandora/core');
     // Must have an accepted interval.
-    $this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => "1 fortnight"], $this->t('Save configuration'));
+    $this->submitForm(['edit-jwt-expiry' => "1 fortnight"], $this->t('Save configuration'));
     $this->assertSession()->pageTextContainsOnce('No time interval found, please include one of');
+    $this->drupalGet('/admin/config/islandora/core');
     // Test a valid setting.
-    $this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => "2 weeks"], $this->t('Save configuration'));
+    $this->submitForm(['edit-jwt-expiry' => "2 weeks"], $this->t('Save configuration'));
     $this->assertSession()->pageTextContainsOnce('The configuration options have been saved.');
 
   }
diff --git a/tests/src/Functional/JsonldSelfReferenceReactionTest.php b/tests/src/Functional/JsonldSelfReferenceReactionTest.php
index f3c88271..7ad8f018 100644
--- a/tests/src/Functional/JsonldSelfReferenceReactionTest.php
+++ b/tests/src/Functional/JsonldSelfReferenceReactionTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\islandora\Functional;
 
+use function GuzzleHttp\json_decode;
 /**
  * Class MappingUriPredicateReactionTest.
  *
@@ -13,7 +14,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $types = ['schema:Thing'];
@@ -61,7 +62,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
 
     $contents = $this->drupalGet($url . '?_format=jsonld');
     $this->assertSession()->statusCodeEquals(200);
-    $json = \GuzzleHttp\json_decode($contents, TRUE);
+    $json = json_decode($contents, TRUE);
     $this->assertArrayHasKey('http://purl.org/dc/terms/title',
       $json['@graph'][0], 'Missing dcterms:title key');
     $this->assertEquals(
@@ -103,7 +104,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
     drupal_flush_all_caches();
 
     $new_contents = $this->drupalGet($url . '?_format=jsonld');
-    $json = \GuzzleHttp\json_decode($new_contents, TRUE);
+    $json = json_decode($new_contents, TRUE);
     $this->assertEquals(
       'Test Node',
       $json['@graph'][0]['http://purl.org/dc/terms/title'][0]['@value'],
@@ -123,7 +124,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
     $this->assertSession()
       ->pageTextContains("The context $context_name has been saved");
     $new_contents = $this->drupalGet($url . '?_format=jsonld');
-    $json = \GuzzleHttp\json_decode($new_contents, TRUE);
+    $json = json_decode($new_contents, TRUE);
     $this->assertEquals(
       'Test Node',
       $json['@graph'][0]['http://purl.org/dc/terms/title'][0]['@value'],
@@ -161,7 +162,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
 
     $contents = $this->drupalGet($media_url . '?_format=jsonld');
     $this->assertSession()->statusCodeEquals(200);
-    $json = \GuzzleHttp\json_decode($contents, TRUE);
+    $json = json_decode($contents, TRUE);
     $this->assertEquals(
       "$media_url?_format=jsonld",
       $json['@graph'][0]['@id'],
@@ -186,7 +187,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
     drupal_flush_all_caches();
 
     $new_contents = $this->drupalGet($media_url . '?_format=jsonld');
-    $json = \GuzzleHttp\json_decode($new_contents, TRUE);
+    $json = json_decode($new_contents, TRUE);
     $this->assertEquals(
       "$media_url?_format=jsonld",
       $json['@graph'][0]['http://www.iana.org/assignments/relation/describedby'][0]['@id'],
diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php
index e5d21abc..58e8bf61 100644
--- a/tests/src/Functional/JsonldTypeAlterReactionTest.php
+++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\islandora\Functional;
 
+use function GuzzleHttp\json_decode;
 /**
  * Tests Jsonld Alter Reaction.
  *
@@ -20,17 +21,18 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
       'administer node fields',
     ]);
     $this->drupalLogin($account);
+    $this->drupalGet('admin/structure/types/manage/test_type/fields/add-field');
 
     // Add the typed predicate we will select in the reaction config.
     // Taken from FieldUiTestTrait->fieldUIAddNewField.
-    $this->drupalPostForm('admin/structure/types/manage/test_type/fields/add-field', [
+    $this->submitForm([
       'new_storage_type' => 'string',
       'label' => 'Typed Predicate',
       'field_name' => 'type_predicate',
     ], $this->t('Save and continue'));
-    $this->drupalPostForm(NULL, [], $this->t('Save field settings'));
-    $this->drupalPostForm(NULL, [], $this->t('Save settings'));
-    $this->assertRaw('field_type_predicate', 'Redirected to "Manage fields" page.');
+    $this->submitForm([], $this->t('Save field settings'));
+    $this->submitForm([], $this->t('Save settings'));
+    $this->assertSession()->responseContains('field_type_predicate');
 
     // Add the test node.
     $this->postNodeAddForm('test_type', [
@@ -46,7 +48,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
 
     $contents = $this->drupalGet($url . '?_format=jsonld');
     $this->assertSession()->statusCodeEquals(200);
-    $json = \GuzzleHttp\json_decode($contents, TRUE);
+    $json = json_decode($contents, TRUE);
     $this->assertArrayHasKey('@type',
       $json['@graph'][0], 'Missing @type');
     $this->assertEquals(
@@ -81,7 +83,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
 
     // Check for the new @type from the field_type_predicate value.
     $new_contents = $this->drupalGet($url . '?_format=jsonld');
-    $json = \GuzzleHttp\json_decode($new_contents, TRUE);
+    $json = json_decode($new_contents, TRUE);
     $this->assertTrue(
       in_array('http://schema.org/Organization', $json['@graph'][0]['@type']),
       'Missing altered @type value of http://schema.org/Organization'
diff --git a/tests/src/Functional/LinkHeaderTest.php b/tests/src/Functional/LinkHeaderTest.php
index 7cb741d5..98b36c68 100644
--- a/tests/src/Functional/LinkHeaderTest.php
+++ b/tests/src/Functional/LinkHeaderTest.php
@@ -42,7 +42,7 @@ class LinkHeaderTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $account = $this->createUserAndLogin();
diff --git a/tests/src/Functional/MediaSourceUpdateTest.php b/tests/src/Functional/MediaSourceUpdateTest.php
index fdea6aef..3c97c695 100644
--- a/tests/src/Functional/MediaSourceUpdateTest.php
+++ b/tests/src/Functional/MediaSourceUpdateTest.php
@@ -35,7 +35,7 @@ class MediaSourceUpdateTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Make a user with appropriate permissions.
diff --git a/tests/src/Functional/NodeHasTermTest.php b/tests/src/Functional/NodeHasTermTest.php
index eff5b5c3..2b4ee16f 100644
--- a/tests/src/Functional/NodeHasTermTest.php
+++ b/tests/src/Functional/NodeHasTermTest.php
@@ -13,7 +13,7 @@ class NodeHasTermTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
 
     parent::setUp();
 
diff --git a/tests/src/Functional/ViewModeAlterReactionTest.php b/tests/src/Functional/ViewModeAlterReactionTest.php
index 72cdfe44..19660bda 100644
--- a/tests/src/Functional/ViewModeAlterReactionTest.php
+++ b/tests/src/Functional/ViewModeAlterReactionTest.php
@@ -26,7 +26,7 @@ class ViewModeAlterReactionTest extends IslandoraFunctionalTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Node to be referenced via member of.
diff --git a/tests/src/FunctionalJavascript/IntegerWeightTest.php b/tests/src/FunctionalJavascript/IntegerWeightTest.php
index ba289aa4..2572c191 100644
--- a/tests/src/FunctionalJavascript/IntegerWeightTest.php
+++ b/tests/src/FunctionalJavascript/IntegerWeightTest.php
@@ -80,7 +80,7 @@ class IntegerWeightTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->adminUser = $this->drupalCreateUser(
diff --git a/tests/src/Kernel/EventGeneratorTest.php b/tests/src/Kernel/EventGeneratorTest.php
index c423cda3..a9c1f082 100644
--- a/tests/src/Kernel/EventGeneratorTest.php
+++ b/tests/src/Kernel/EventGeneratorTest.php
@@ -41,7 +41,7 @@ class EventGeneratorTest extends IslandoraKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Create a test user.
diff --git a/tests/src/Kernel/FedoraAdapterTest.php b/tests/src/Kernel/FedoraAdapterTest.php
index e5161063..d6adecbb 100644
--- a/tests/src/Kernel/FedoraAdapterTest.php
+++ b/tests/src/Kernel/FedoraAdapterTest.php
@@ -2,6 +2,9 @@
 
 namespace Drupal\Tests\islandora\Kernel;
 
+use Prophecy\PhpUnit\ProphecyTrait;
+use GuzzleHttp\Psr7\Utils;
+use function GuzzleHttp\Psr7\stream_for;
 use Drupal\Core\Logger\LoggerChannelInterface;
 use Drupal\islandora\Flysystem\Adapter\FedoraAdapter;
 use GuzzleHttp\Psr7\Response;
@@ -18,6 +21,7 @@ use Symfony\Component\Mime\MimeTypeGuesserInterface;
  */
 class FedoraAdapterTest extends IslandoraKernelTestBase {
 
+  use ProphecyTrait;
   /**
    * A mimetype guesser prophecy.
    *
@@ -35,7 +39,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->mimeGuesser = $this->prophesize(MimeTypeGuesserInterface::class)
       ->reveal();
@@ -58,10 +62,10 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
     $prophecy->getHeader('Content-Type')->willReturn(['text/plain']);
     $prophecy->getHeader('Content-Length')->willReturn([strlen("DERP")]);
     // phpcs:disable
-    if (class_exists(\GuzzleHttp\Psr7\Utils::class)) {
-      $prophecy->getBody()->willReturn(\GuzzleHttp\Psr7\Utils::streamFor("DERP"));
+    if (class_exists(Utils::class)) {
+      $prophecy->getBody()->willReturn(Utils::streamFor("DERP"));
     } else {
-      $prophecy->getBody()->willReturn(\GuzzleHttp\Psr7\stream_for("DERP"));
+      $prophecy->getBody()->willReturn(stream_for("DERP"));
     }
     // phpcs:enable
     return $prophecy;
diff --git a/tests/src/Kernel/IslandoraKernelTestBase.php b/tests/src/Kernel/IslandoraKernelTestBase.php
index 5a95cb68..1c98db3e 100644
--- a/tests/src/Kernel/IslandoraKernelTestBase.php
+++ b/tests/src/Kernel/IslandoraKernelTestBase.php
@@ -12,7 +12,7 @@ abstract class IslandoraKernelTestBase extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = [
+  protected static $modules = [
     'system',
     'user',
     'field',
@@ -43,7 +43,7 @@ abstract class IslandoraKernelTestBase extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     // Bootstrap minimal Drupal environment to run the tests.
diff --git a/tests/src/Kernel/JwtEventSubscriberTest.php b/tests/src/Kernel/JwtEventSubscriberTest.php
index f97eab9f..9493ab78 100644
--- a/tests/src/Kernel/JwtEventSubscriberTest.php
+++ b/tests/src/Kernel/JwtEventSubscriberTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\islandora\Kernel;
 
+use Prophecy\PhpUnit\ProphecyTrait;
 use Drupal\jwt\Authentication\Event\JwtAuthGenerateEvent;
 use Drupal\jwt\Authentication\Event\JwtAuthValidEvent;
 use Drupal\jwt\Authentication\Event\JwtAuthValidateEvent;
@@ -19,6 +20,7 @@ use Drupal\islandora\EventSubscriber\JwtEventSubscriber;
  */
 class JwtEventSubscriberTest extends IslandoraKernelTestBase {
 
+  use ProphecyTrait;
   use UserCreationTrait;
 
   /**
@@ -31,7 +33,7 @@ class JwtEventSubscriberTest extends IslandoraKernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->user = $this->createUser();

From 2c332348dca507b090b3514048454ec998baf4e1 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Tue, 13 Jun 2023 15:12:13 -0300
Subject: [PATCH 50/64] Undo overzealous Rector.

---
 .github/workflows/build-2.x.yml               |  1 -
 .../install/views.view.all_taxonomy_terms.yml |  1 -
 .../install/views.view.file_checksum.yml      |  1 -
 .../install/views.view.non_fedora_files.yml   |  1 -
 .../src/Plugin/views/style/IIIFManifest.php   | 33 +++++++++++++++++--
 .../src/Controller/MediaSourceController.php  | 18 ++++++++--
 .../AbstractFileSelectionForm.php             |  7 +---
 .../JsonldSelfReferenceReactionTest.php       |  1 +
 .../JsonldTypeAlterReactionTest.php           |  1 +
 9 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml
index 439395b0..d05222d9 100644
--- a/.github/workflows/build-2.x.yml
+++ b/.github/workflows/build-2.x.yml
@@ -123,4 +123,3 @@ jobs:
         run: |
           cd $DRUPAL_DIR/web/core
           $DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}"
-
diff --git a/modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml b/modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml
index 56b45066..8c3cb0f3 100644
--- a/modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml
+++ b/modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml
@@ -168,4 +168,3 @@ display:
         - url.query_args
         - user.permissions
       tags: {  }
-
diff --git a/modules/islandora_core_feature/config/install/views.view.file_checksum.yml b/modules/islandora_core_feature/config/install/views.view.file_checksum.yml
index 2c819101..e529f21e 100644
--- a/modules/islandora_core_feature/config/install/views.view.file_checksum.yml
+++ b/modules/islandora_core_feature/config/install/views.view.file_checksum.yml
@@ -304,4 +304,3 @@ display:
         - url
         - user.permissions
       tags: {  }
-
diff --git a/modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml b/modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml
index 88b0f308..b90494f5 100644
--- a/modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml
+++ b/modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml
@@ -194,4 +194,3 @@ display:
         - url.query_args
         - user.permissions
       tags: {  }
-
diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
index 63f015d1..b76628d7 100644
--- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
+++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
@@ -93,10 +93,17 @@ class IIIFManifest extends StylePluginBase {
    */
   protected $messenger;
 
+  /**
+   * Module Handler for running hooks.
+   *
+   * @var \Drupal\Core\Extention\ModuleHandlerInterface
+   */
+  protected $moduleHandler;
+
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger, ModuleHandlerInterface $moduleHandler) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
 
     $this->serializer = $serializer;
@@ -106,6 +113,7 @@ class IIIFManifest extends StylePluginBase {
     $this->fileSystem = $file_system;
     $this->httpClient = $http_client;
     $this->messenger = $messenger;
+    $this->moduleHandler = $moduleHandler;
   }
 
   /**
@@ -122,10 +130,21 @@ class IIIFManifest extends StylePluginBase {
       $container->get('entity_type.manager'),
       $container->get('file_system'),
       $container->get('http_client'),
-      $container->get('messenger')
+      $container->get('messenger'),
+      $container->get('module_handler')
     );
   }
 
+  /**
+   * Return the request property.
+   *
+   * @return \Symfony\Component\HttpFoundation\Request
+   *   The Symfony request object
+   */
+  public function getRequest() {
+    return $this->request;
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -172,6 +191,9 @@ class IIIFManifest extends StylePluginBase {
 
     $content_type = 'json';
 
+    // Give other modules a chance to alter the manifest.
+    $this->moduleHandler->alter('islandora_iiif_manifest', $json, $this);
+
     return $this->serializer->serialize($json, $content_type, ['views_style_plugin' => $this]);
   }
 
@@ -255,6 +277,13 @@ class IIIFManifest extends StylePluginBase {
             ];
           }
 
+          // Give other modules a chance to alter the canvas.
+          $alter_options = [
+            'options' => $this->options,
+            'views_plugin' => $this,
+          ];
+          $this->moduleHandler->alter('islandora_iiif_manifest_canvas', $tmp_canvas, $row, $alter_options);
+
           $canvases[] = $tmp_canvas;
         }
       }
diff --git a/modules/islandora_text_extraction/src/Controller/MediaSourceController.php b/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
index 5518220d..6b886308 100644
--- a/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
+++ b/modules/islandora_text_extraction/src/Controller/MediaSourceController.php
@@ -5,6 +5,7 @@ namespace Drupal\islandora_text_extraction\Controller;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\File\FileSystem;
 use Drupal\Core\File\FileSystemInterface;
+use Drupal\file\FileRepository;
 use Drupal\media\Entity\Media;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\Request;
@@ -42,14 +43,24 @@ class MediaSourceController extends ControllerBase {
    */
   protected $fileSystem;
 
+  /**
+   * File repository service.
+   *
+   * @var \Drupal\file\FileRepository
+   */
+  protected $fileRepository;
+
   /**
    * MediaSourceController constructor.
    *
    * @param \Drupal\Core\File\FileSystem $fileSystem
    *   Filesystem service.
+   * @param \Drupal\file\FileRepository $fileRepository
+   *   File Repository service.
    */
-  public function __construct(FileSystem $fileSystem) {
+  public function __construct(FileSystem $fileSystem, FileRepository $fileRepository) {
     $this->fileSystem = $fileSystem;
+    $this->fileRepository = $fileRepository;
   }
 
   /**
@@ -63,7 +74,8 @@ class MediaSourceController extends ControllerBase {
    */
   public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('file_system')
+      $container->get('file_system'),
+      $container->get('file.repository'),
     );
   }
 
@@ -98,7 +110,7 @@ class MediaSourceController extends ControllerBase {
       if (!$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
         throw new HttpException(500, "The destination directory does not exist, could not be created, or is not writable");
       }
-      $file = \Drupal::service('file.repository')->writeData($contents, $content_location, FileSystemInterface::EXISTS_REPLACE);
+      $file = $this->fileRepository->writeData($contents, $content_location, FileSystemInterface::EXISTS_REPLACE);
       if ($media->hasField($destination_field)) {
         $media->{$destination_field}->setValue([
           'target_id' => $file->id(),
diff --git a/src/Form/AddChildrenWizard/AbstractFileSelectionForm.php b/src/Form/AddChildrenWizard/AbstractFileSelectionForm.php
index cf6ef305..6aeed879 100644
--- a/src/Form/AddChildrenWizard/AbstractFileSelectionForm.php
+++ b/src/Form/AddChildrenWizard/AbstractFileSelectionForm.php
@@ -37,11 +37,6 @@ abstract class AbstractFileSelectionForm extends FormBase {
    * @var \Drupal\islandora\Form\AddChildrenWizard\AbstractBatchProcessor|null
    */
   protected ?AbstractBatchProcessor $batchProcessor;
-  private \static $static;
-  public function __construct(\static $static)
-  {
-      $this->static = $static;
-  }
 
   /**
    * {@inheritdoc}
@@ -54,7 +49,7 @@ abstract class AbstractFileSelectionForm extends FormBase {
     $instance->entityFieldManager = $container->get('entity_field.manager');
     $instance->currentUser = $container->get('current_user');
 
-    $instance->batchProcessor = $this->static;
+    $instance->batchProcessor = $container->get(static::BATCH_PROCESSOR);
 
     return $instance;
   }
diff --git a/tests/src/Functional/JsonldSelfReferenceReactionTest.php b/tests/src/Functional/JsonldSelfReferenceReactionTest.php
index 7ad8f018..92eca07a 100644
--- a/tests/src/Functional/JsonldSelfReferenceReactionTest.php
+++ b/tests/src/Functional/JsonldSelfReferenceReactionTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\islandora\Functional;
 
 use function GuzzleHttp\json_decode;
+
 /**
  * Class MappingUriPredicateReactionTest.
  *
diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php
index 58e8bf61..80a6039c 100644
--- a/tests/src/Functional/JsonldTypeAlterReactionTest.php
+++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\islandora\Functional;
 
 use function GuzzleHttp\json_decode;
+
 /**
  * Tests Jsonld Alter Reaction.
  *

From ffd128db80c46f4e480f70d99726e4786f6a1621 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Thu, 22 Jun 2023 16:02:25 -0300
Subject: [PATCH 51/64] Typo prevented submodule functional tests from running.

---
 .github/workflows/build-2.x.yml | 2 +-
 phpunit.xml                     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml
index d05222d9..261ab1de 100644
--- a/.github/workflows/build-2.x.yml
+++ b/.github/workflows/build-2.x.yml
@@ -28,7 +28,7 @@ jobs:
         # test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver.
         test-suite: ["kernel", "functional", "functional-javascript"]
         # Not yet Drupal 10 ready - see https://github.com/Islandora/islandora/issues/888
-        drupal-version: ["9.3.x", "9.4.x", "9.5.x-dev"]
+        drupal-version: ["9.4.x", "9.5.x-dev"]
         mysql: ["8.0"]
         allowed_failure: [false]
 
diff --git a/phpunit.xml b/phpunit.xml
index a4091781..46e82e78 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -58,7 +58,7 @@
     </testsuite>
     <testsuite name="functional">
       <directory>../modules/contrib/islandora/tests/src/Functional</directory>
-      <directory>../modules/contrib/isladnora/modules/*/tests/src/Functional</directory>
+      <directory>../modules/contrib/islandora/modules/*/tests/src/Functional</directory>
     </testsuite>
     <testsuite name="functional-javascript">
       <directory>../modules/contrib/islandora/tests/src/FunctionalJavascript</directory>

From 9cabfc2e23ca3f7dbfd962f817201b2c0f8fb97e Mon Sep 17 00:00:00 2001
From: Jordan Dukart <jordan@discoverygarden.ca>
Date: Fri, 30 Jun 2023 10:06:28 -0300
Subject: [PATCH 52/64] Fix a typo. (#958)

---
 .../src/Plugin/Action/GenerateOCRDerivativeFile.php             | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivativeFile.php b/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivativeFile.php
index 4ff0d93f..565d7564 100644
--- a/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivativeFile.php
+++ b/modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivativeFile.php
@@ -99,7 +99,7 @@ class GenerateOCRDerivativeFile extends AbstractGenerateDerivativeMediaFile {
         break;
 
       case 'plain_text':
-        $his->configuration['args'] = '';
+        $this->configuration['args'] = '';
         break;
     }
   }

From 8f8e6a3c35bd5afb193272547203c4ee807dc24d Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Fri, 23 Jun 2023 15:01:43 -0300
Subject: [PATCH 53/64] Test: Breadcrumbs config dependencies missing schema.

---
 .../config/install/islandora_breadcrumbs.breadcrumbs.yml    | 6 ------
 .../islandora_breadcrumbs/islandora_breadcrumbs.info.yml    | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/modules/islandora_breadcrumbs/config/install/islandora_breadcrumbs.breadcrumbs.yml b/modules/islandora_breadcrumbs/config/install/islandora_breadcrumbs.breadcrumbs.yml
index ea34ee2e..aabb5891 100644
--- a/modules/islandora_breadcrumbs/config/install/islandora_breadcrumbs.breadcrumbs.yml
+++ b/modules/islandora_breadcrumbs/config/install/islandora_breadcrumbs.breadcrumbs.yml
@@ -2,9 +2,3 @@ maxDepth: -1
 includeSelf: FALSE
 referenceFields: 
   - field_member_of
-dependencies:
-  module:
-    - islandora
-  enforced:
-    module:
-      - islandora_breadcrumbs
diff --git a/modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml b/modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml
index 56a10bc1..c76020cb 100644
--- a/modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml
+++ b/modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml
@@ -5,4 +5,4 @@ core: 8.x
 core_version_requirement: ^8 || ^9
 package: Islandora
 dependencies:
-  - drupal:islandora
+  - islandora:islandora

From 7470327871a1bb2b8732a7e11c5ad4dc5eb879d4 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Fri, 23 Jun 2023 15:24:29 -0300
Subject: [PATCH 54/64] Inject fileUrlGenerator into Image Field formatter.

---
 .../Field/FieldFormatter/IslandoraImageFormatter.php | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php b/src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php
index 6c6e87da..6667f4f4 100644
--- a/src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php
@@ -5,6 +5,7 @@ namespace Drupal\islandora\Plugin\Field\FieldFormatter;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\File\FileUrlGenerator;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter;
 use Drupal\islandora\IslandoraUtils;
@@ -56,6 +57,8 @@ class IslandoraImageFormatter extends ImageFormatter {
    *   The image style storage.
    * @param \Drupal\islandora\IslandoraUtils $utils
    *   Islandora utils.
+   * @param \Drupal\Core\File\FileUrlGenerator $file_url_generator
+   *   The File URL Generator.
    */
   public function __construct(
     $plugin_id,
@@ -67,7 +70,8 @@ class IslandoraImageFormatter extends ImageFormatter {
     array $third_party_settings,
     AccountInterface $current_user,
     EntityStorageInterface $image_style_storage,
-    IslandoraUtils $utils
+    IslandoraUtils $utils,
+    FileUrlGenerator $file_url_generator
   ) {
     parent::__construct(
       $plugin_id,
@@ -78,7 +82,8 @@ class IslandoraImageFormatter extends ImageFormatter {
       $view_mode,
       $third_party_settings,
       $current_user,
-      $image_style_storage
+      $image_style_storage,
+      $file_url_generator
     );
     $this->utils = $utils;
   }
@@ -97,7 +102,8 @@ class IslandoraImageFormatter extends ImageFormatter {
       $configuration['third_party_settings'],
       $container->get('current_user'),
       $container->get('entity_type.manager')->getStorage('image_style'),
-      $container->get('islandora.utils')
+      $container->get('islandora.utils'),
+      $container->get('file_url_generator')
     );
   }
 

From e4dc48fca2dab39c7ab709c445a3fe14551052ea Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Fri, 23 Jun 2023 16:39:34 -0300
Subject: [PATCH 55/64] Tests were not finding the media use field.

---
 .../tests/src/Functional/GenerateAudioDerivativeTest.php        | 2 +-
 .../tests/src/Functional/GenerateImageDerivativeTest.php        | 2 +-
 .../tests/src/Functional/GenerateVideoDerivativeTest.php        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
index 766ceac0..b528e8ba 100644
--- a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
+++ b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
@@ -66,7 +66,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_tags[0][target_id]' => 'Preservation Master',
+      'field_media_use[0][target_id]' => 'foo', # change back to $this->preservationMasterTerm->label()
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
index 295eae91..69672e0b 100644
--- a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
+++ b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
@@ -68,7 +68,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_tags[0][target_id]' => 'Preservation Master',
+      'field_media_use[0][target_id]' => 'foo', # change back to $this->preservationMasterTerm->label()
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
index 17e8bd5b..f712e349 100644
--- a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
+++ b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
@@ -63,7 +63,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_tags[0][target_id]' => 'Preservation Master',
+      'field_media_use[0][target_id]' => 'foo', # change back to $this->preservationMasterTerm->label()
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));

From 52947f3f9676983c7d19f4e4489ec4aa3d374265 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Mon, 26 Jun 2023 13:20:54 -0300
Subject: [PATCH 56/64] Use phpcs friendly comment...

---
 .../tests/src/Functional/GenerateAudioDerivativeTest.php        | 2 +-
 .../tests/src/Functional/GenerateImageDerivativeTest.php        | 2 +-
 .../tests/src/Functional/GenerateVideoDerivativeTest.php        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
index b528e8ba..a7425917 100644
--- a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
+++ b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
@@ -66,7 +66,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo', # change back to $this->preservationMasterTerm->label()
+      'field_media_use[0][target_id]' => 'foo', // change back to $this->preservationMasterTerm->label()
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
index 69672e0b..2e1f5591 100644
--- a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
+++ b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
@@ -68,7 +68,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo', # change back to $this->preservationMasterTerm->label()
+      'field_media_use[0][target_id]' => 'foo', // change back to $this->preservationMasterTerm->label()
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
index f712e349..3a556987 100644
--- a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
+++ b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
@@ -63,7 +63,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo', # change back to $this->preservationMasterTerm->label()
+      'field_media_use[0][target_id]' => 'foo', // change back to $this->preservationMasterTerm->label()
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));

From e67e8e5f25a20740af8a0647aedc033aa5c06ba1 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Mon, 26 Jun 2023 13:32:33 -0300
Subject: [PATCH 57/64] Remove problematic comments.

---
 .../tests/src/Functional/GenerateAudioDerivativeTest.php        | 2 +-
 .../tests/src/Functional/GenerateImageDerivativeTest.php        | 2 +-
 .../tests/src/Functional/GenerateVideoDerivativeTest.php        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
index a7425917..5c1b616e 100644
--- a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
+++ b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
@@ -66,7 +66,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo', // change back to $this->preservationMasterTerm->label()
+      'field_media_use[0][target_id]' => 'foo',
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
index 2e1f5591..7544cb65 100644
--- a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
+++ b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
@@ -68,7 +68,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo', // change back to $this->preservationMasterTerm->label()
+      'field_media_use[0][target_id]' => 'foo',
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
index 3a556987..264cebb7 100644
--- a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
+++ b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
@@ -63,7 +63,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo', // change back to $this->preservationMasterTerm->label()
+      'field_media_use[0][target_id]' => 'foo',
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));

From 8ef277527b2ee715331a1c46e28a3ee90c62f5c9 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Tue, 27 Jun 2023 12:05:11 -0300
Subject: [PATCH 58/64] Fix tests.

---
 .../tests/src/Functional/GenerateAudioDerivativeTest.php      | 2 +-
 .../tests/src/Functional/GenerateImageDerivativeTest.php      | 2 +-
 .../tests/src/Functional/GenerateVideoDerivativeTest.php      | 2 +-
 ...core.entity_form_display.media.test_media_type.default.yml | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
index 5c1b616e..6b85cd1b 100644
--- a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
+++ b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
@@ -66,7 +66,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo',
+      'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
index 7544cb65..44cdda58 100644
--- a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
+++ b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
@@ -68,7 +68,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo',
+      'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
index 264cebb7..de06ba2f 100644
--- a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
+++ b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
@@ -63,7 +63,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
       'name[0][value]' => 'Test Media',
       'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
       'field_media_of[0][target_id]' => 'Test Node',
-      'field_media_use[0][target_id]' => 'foo',
+      'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
     ];
     $this->drupalGet('media/add/' . $this->testMediaType->id());
     $this->submitForm($values, $this->t('Save'));
diff --git a/tests/fixtures/config/core.entity_form_display.media.test_media_type.default.yml b/tests/fixtures/config/core.entity_form_display.media.test_media_type.default.yml
index 19fe419b..d261542d 100644
--- a/tests/fixtures/config/core.entity_form_display.media.test_media_type.default.yml
+++ b/tests/fixtures/config/core.entity_form_display.media.test_media_type.default.yml
@@ -3,7 +3,7 @@ status: true
 dependencies:
   config:
     - field.field.media.test_media_type.field_media_of
-    - field.field.media.test_media_type.field_tags
+    - field.field.media.test_media_type.field_media_use
     - media.type.test_media_type
   module:
     - path
@@ -37,7 +37,7 @@ content:
       size: 60
       placeholder: ''
     third_party_settings: {  }
-  field_tags:
+  field_media_use:
     type: entity_reference_autocomplete
     weight: 3
     region: content

From a88486ca285c5325c9b60d63151b10b218f93070 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Tue, 27 Jun 2023 12:23:44 -0300
Subject: [PATCH 59/64] Add accessCheck FALSE to all queries.

---
 src/IslandoraUtils.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/IslandoraUtils.php b/src/IslandoraUtils.php
index f81cb747..41f84cbe 100644
--- a/src/IslandoraUtils.php
+++ b/src/IslandoraUtils.php
@@ -148,6 +148,7 @@ class IslandoraUtils {
       return [];
     }
     $mids = $this->entityTypeManager->getStorage('media')->getQuery()
+      ->accessCheck(FALSE)
       ->condition(self::MEDIA_OF_FIELD, $node->id())
       ->execute();
     if (empty($mids)) {
@@ -208,6 +209,7 @@ class IslandoraUtils {
 
     // Query for media that reference this file.
     $query = $this->entityTypeManager->getStorage('media')->getQuery();
+    $query->accessCheck(FALSE);
     $group = $query->orConditionGroup();
     foreach ($conditions as $condition) {
       $group->condition($condition, $fid);
@@ -252,6 +254,7 @@ class IslandoraUtils {
     }
 
     $results = $query
+      ->accessCheck(FALSE)
       ->condition($orGroup)
       ->execute();
 
@@ -498,6 +501,7 @@ class IslandoraUtils {
     array_walk($node_fields, $remove_entity);
 
     $query = $this->entityTypeManager->getStorage('media')->getQuery();
+    $query->accessCheck(FALSE);
     $taxon_condition = $this->getEntityQueryOrCondition($query, $term_fields, $term->id());
     $query->condition($taxon_condition);
     $node_condition = $this->getEntityQueryOrCondition($query, $node_fields, $node->id());

From d293d7702a2de0417ee78afcd92aad2f52e06924 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Tue, 27 Jun 2023 13:10:48 -0300
Subject: [PATCH 60/64] Change to check access (true).

---
 src/IslandoraUtils.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/IslandoraUtils.php b/src/IslandoraUtils.php
index 41f84cbe..a2df7589 100644
--- a/src/IslandoraUtils.php
+++ b/src/IslandoraUtils.php
@@ -148,7 +148,7 @@ class IslandoraUtils {
       return [];
     }
     $mids = $this->entityTypeManager->getStorage('media')->getQuery()
-      ->accessCheck(FALSE)
+      ->accessCheck(TRUE)
       ->condition(self::MEDIA_OF_FIELD, $node->id())
       ->execute();
     if (empty($mids)) {
@@ -209,7 +209,7 @@ class IslandoraUtils {
 
     // Query for media that reference this file.
     $query = $this->entityTypeManager->getStorage('media')->getQuery();
-    $query->accessCheck(FALSE);
+    $query->accessCheck(TRUE);
     $group = $query->orConditionGroup();
     foreach ($conditions as $condition) {
       $group->condition($condition, $fid);
@@ -254,7 +254,7 @@ class IslandoraUtils {
     }
 
     $results = $query
-      ->accessCheck(FALSE)
+      ->accessCheck(TRUE)
       ->condition($orGroup)
       ->execute();
 
@@ -501,7 +501,7 @@ class IslandoraUtils {
     array_walk($node_fields, $remove_entity);
 
     $query = $this->entityTypeManager->getStorage('media')->getQuery();
-    $query->accessCheck(FALSE);
+    $query->accessCheck(TRUE);
     $taxon_condition = $this->getEntityQueryOrCondition($query, $term_fields, $term->id());
     $query->condition($taxon_condition);
     $node_condition = $this->getEntityQueryOrCondition($query, $node_fields, $node->id());

From d1861de270a3c7cf5d87cb8be8e2b71a0510047a Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Wed, 28 Jun 2023 10:00:43 -0300
Subject: [PATCH 61/64] Test on 8.1.

---
 .github/workflows/build-2.x.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml
index 261ab1de..27506495 100644
--- a/.github/workflows/build-2.x.yml
+++ b/.github/workflows/build-2.x.yml
@@ -24,11 +24,11 @@ jobs:
       fail-fast: false
       matrix:
         # PHP 8.1 fails - see https://github.com/Islandora/islandora/issues/887
-        php-versions: ["7.4", "8.0"]
+        php-versions: ["7.4", "8.0", "8.1"]
         # test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver.
         test-suite: ["kernel", "functional", "functional-javascript"]
         # Not yet Drupal 10 ready - see https://github.com/Islandora/islandora/issues/888
-        drupal-version: ["9.4.x", "9.5.x-dev"]
+        drupal-version: ["9.4.x", "9.5.x"]
         mysql: ["8.0"]
         allowed_failure: [false]
 

From 8adc44859cd679c759766af49fa5edf42c2a1452 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Thu, 29 Jun 2023 13:34:11 -0300
Subject: [PATCH 62/64] Update fixtures to have config UUIDs.

---
 ..._display.media.test_media_type.default.yml |  5 ++++
 ...ty_form_display.node.test_type.default.yml | 29 ++++++++++++++-----
 ..._form_display.node.test_type.secondary.yml |  8 +++--
 .../core.entity_form_mode.node.secondary.yml  |  5 ++--
 ...ty_view_display.node.test_type.default.yml | 15 ++++++++--
 ...ity_view_display.node.test_type.teaser.yml | 16 ++++++----
 .../config/rest.resource.entity.file.yml      |  2 ++
 .../config/rest.resource.entity.media.yml     |  3 +-
 .../config/rest.resource.entity.node.yml      |  1 +
 .../rest.resource.entity.taxonomy_term.yml    |  1 +
 10 files changed, 64 insertions(+), 21 deletions(-)

diff --git a/tests/fixtures/config/core.entity_form_display.media.test_media_type.default.yml b/tests/fixtures/config/core.entity_form_display.media.test_media_type.default.yml
index d261542d..ea8eac00 100644
--- a/tests/fixtures/config/core.entity_form_display.media.test_media_type.default.yml
+++ b/tests/fixtures/config/core.entity_form_display.media.test_media_type.default.yml
@@ -1,7 +1,9 @@
+uuid: 9151a0fe-7729-4943-b506-dd6f8d12ceac
 langcode: en
 status: true
 dependencies:
   config:
+    - field.field.media.test_media_type.field_media_file
     - field.field.media.test_media_type.field_media_of
     - field.field.media.test_media_type.field_media_use
     - media.type.test_media_type
@@ -34,6 +36,7 @@ content:
     region: content
     settings:
       match_operator: CONTAINS
+      match_limit: 10
       size: 60
       placeholder: ''
     third_party_settings: {  }
@@ -43,6 +46,7 @@ content:
     region: content
     settings:
       match_operator: CONTAINS
+      match_limit: 10
       size: 60
       placeholder: ''
     third_party_settings: {  }
@@ -64,6 +68,7 @@ content:
     weight: 4
     settings:
       match_operator: CONTAINS
+      match_limit: 10
       size: 60
       placeholder: ''
     region: content
diff --git a/tests/fixtures/config/core.entity_form_display.node.test_type.default.yml b/tests/fixtures/config/core.entity_form_display.node.test_type.default.yml
index 2560ec6e..68724265 100644
--- a/tests/fixtures/config/core.entity_form_display.node.test_type.default.yml
+++ b/tests/fixtures/config/core.entity_form_display.node.test_type.default.yml
@@ -1,12 +1,13 @@
+uuid: 90a6909f-a2aa-44e8-8b61-4cd54ec6974f
 langcode: en
 status: true
 dependencies:
   config:
     - field.field.node.test_type.field_member_of
+    - field.field.node.test_type.field_model
     - node.type.test_type
   module:
     - path
-    - text
 id: node.test_type.default
 targetEntityType: node
 bundle: test_type
@@ -19,14 +20,25 @@ content:
     settings: {  }
     third_party_settings: {  }
   field_member_of:
+    type: entity_reference_autocomplete
     weight: 122
+    region: content
     settings:
       match_operator: CONTAINS
+      match_limit: 10
       size: 60
       placeholder: ''
     third_party_settings: {  }
+  field_model:
     type: entity_reference_autocomplete
+    weight: 123
     region: content
+    settings:
+      match_operator: CONTAINS
+      match_limit: 10
+      size: 60
+      placeholder: ''
+    third_party_settings: {  }
   langcode:
     type: language_select
     weight: 2
@@ -42,24 +54,24 @@ content:
     third_party_settings: {  }
   promote:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 15
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   status:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 120
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   sticky:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 16
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   title:
     type: string_textfield
@@ -72,10 +84,11 @@ content:
   uid:
     type: entity_reference_autocomplete
     weight: 5
+    region: content
     settings:
       match_operator: CONTAINS
+      match_limit: 10
       size: 60
       placeholder: ''
-    region: content
     third_party_settings: {  }
 hidden: {  }
diff --git a/tests/fixtures/config/core.entity_form_display.node.test_type.secondary.yml b/tests/fixtures/config/core.entity_form_display.node.test_type.secondary.yml
index b1fdb88e..f8f05beb 100644
--- a/tests/fixtures/config/core.entity_form_display.node.test_type.secondary.yml
+++ b/tests/fixtures/config/core.entity_form_display.node.test_type.secondary.yml
@@ -1,12 +1,12 @@
+uuid: e24c2b3c-60e4-4ff5-99cb-80e5e67e7b04
 langcode: en
 status: true
 dependencies:
   config:
+    - core.entity_form_mode.node.secondary
     - field.field.node.test_type.field_member_of
+    - field.field.node.test_type.field_model
     - node.type.test_type
-  module:
-    - path
-    - text
 id: node.test_type.secondary
 targetEntityType: node
 bundle: test_type
@@ -23,6 +23,8 @@ content:
 hidden:
   created: true
   field_media: true
+  field_member_of: true
+  field_model: true
   field_node: true
   langcode: true
   path: true
diff --git a/tests/fixtures/config/core.entity_form_mode.node.secondary.yml b/tests/fixtures/config/core.entity_form_mode.node.secondary.yml
index 07f45bbe..e1fc7634 100644
--- a/tests/fixtures/config/core.entity_form_mode.node.secondary.yml
+++ b/tests/fixtures/config/core.entity_form_mode.node.secondary.yml
@@ -1,9 +1,10 @@
+uuid: d9f22219-ff4c-48cc-a98a-6ccaad7a880d
 langcode: en
 status: true
 dependencies:
   module:
     - node
 id: node.secondary
-label: Secondary 
+label: Secondary
 targetEntityType: node
-cache: true
+cache: true
\ No newline at end of file
diff --git a/tests/fixtures/config/core.entity_view_display.node.test_type.default.yml b/tests/fixtures/config/core.entity_view_display.node.test_type.default.yml
index cf798265..e4414e61 100644
--- a/tests/fixtures/config/core.entity_view_display.node.test_type.default.yml
+++ b/tests/fixtures/config/core.entity_view_display.node.test_type.default.yml
@@ -1,11 +1,12 @@
+uuid: 36f4aecf-0e14-4281-a213-ca7d129da52a
 langcode: en
 status: true
 dependencies:
   config:
     - field.field.node.test_type.field_member_of
+    - field.field.node.test_type.field_model
     - node.type.test_type
   module:
-    - text
     - user
 id: node.test_type.default
 targetEntityType: node
@@ -13,14 +14,24 @@ bundle: test_type
 mode: default
 content:
   field_member_of:
-    weight: 102
+    type: entity_reference_label
     label: above
     settings:
       link: true
     third_party_settings: {  }
+    weight: 102
+    region: content
+  field_model:
     type: entity_reference_label
+    label: above
+    settings:
+      link: true
+    third_party_settings: {  }
+    weight: 103
     region: content
   links:
+    settings: {  }
+    third_party_settings: {  }
     weight: 100
     region: content
 hidden:
diff --git a/tests/fixtures/config/core.entity_view_display.node.test_type.teaser.yml b/tests/fixtures/config/core.entity_view_display.node.test_type.teaser.yml
index d67060f7..f7295428 100644
--- a/tests/fixtures/config/core.entity_view_display.node.test_type.teaser.yml
+++ b/tests/fixtures/config/core.entity_view_display.node.test_type.teaser.yml
@@ -1,19 +1,25 @@
-uuid: 0308339a-a9e5-4a04-8ce2-9f62ed504e34
+uuid: b337f462-8e64-4853-be65-9e03b94515bf
 langcode: en
 status: true
 dependencies:
   config:
     - core.entity_view_mode.node.teaser
+    - field.field.node.test_type.field_member_of
+    - field.field.node.test_type.field_model
     - node.type.test_type
   module:
-    - text
     - user
 id: node.test_type.teaser
 targetEntityType: node
 bundle: test_type
 mode: teaser
 content:
+  links:
+    settings: {  }
+    third_party_settings: {  }
+    weight: 100
+    region: content
 hidden:
-  body: true
-  links: true
-  langcode: true
+  field_member_of: true
+  field_model: true
+  langcode: true
\ No newline at end of file
diff --git a/tests/fixtures/config/rest.resource.entity.file.yml b/tests/fixtures/config/rest.resource.entity.file.yml
index 6a136c3c..dbd6bb62 100644
--- a/tests/fixtures/config/rest.resource.entity.file.yml
+++ b/tests/fixtures/config/rest.resource.entity.file.yml
@@ -1,3 +1,4 @@
+uuid: 11c4e25e-6b06-4270-b934-243e4f4aade1
 langcode: en
 status: true
 dependencies:
@@ -26,3 +27,4 @@ configuration:
     supported_auth:
       - basic_auth
       - jwt_auth
+      - cookie
diff --git a/tests/fixtures/config/rest.resource.entity.media.yml b/tests/fixtures/config/rest.resource.entity.media.yml
index 3ed0286e..cd89243d 100644
--- a/tests/fixtures/config/rest.resource.entity.media.yml
+++ b/tests/fixtures/config/rest.resource.entity.media.yml
@@ -1,3 +1,4 @@
+uuid: 9a5633b1-6a1a-40b2-8482-c24cf44122ff
 langcode: en
 status: true
 dependencies:
@@ -5,7 +6,7 @@ dependencies:
     - basic_auth
     - jsonld
     - jwt
-    - media_entity
+    - media
     - serialization
     - user
 id: entity.media
diff --git a/tests/fixtures/config/rest.resource.entity.node.yml b/tests/fixtures/config/rest.resource.entity.node.yml
index e7d4c7cc..a3e253e2 100644
--- a/tests/fixtures/config/rest.resource.entity.node.yml
+++ b/tests/fixtures/config/rest.resource.entity.node.yml
@@ -1,3 +1,4 @@
+uuid: 08a90469-0355-4b41-a4d6-cb6b53072b8c
 langcode: en
 status: true
 dependencies:
diff --git a/tests/fixtures/config/rest.resource.entity.taxonomy_term.yml b/tests/fixtures/config/rest.resource.entity.taxonomy_term.yml
index 25b6fbb2..16d96c3e 100644
--- a/tests/fixtures/config/rest.resource.entity.taxonomy_term.yml
+++ b/tests/fixtures/config/rest.resource.entity.taxonomy_term.yml
@@ -1,3 +1,4 @@
+uuid: 7534e393-12a7-498c-a4a3-a7bbe4ff9a5d
 langcode: en
 status: true
 dependencies:

From aec8178846c23bb952b1f9902d86296528b9864f Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Thu, 29 Jun 2023 13:34:43 -0300
Subject: [PATCH 63/64] Stop using deprecated FILE_STATUS_PERMANENT.

---
 tests/src/Functional/DeleteNodeWithMediaAndFile.php  | 2 +-
 tests/src/Functional/IslandoraFunctionalTestBase.php | 2 +-
 tests/src/Functional/IslandoraImageFormatterTest.php | 2 +-
 tests/src/Functional/JsonldTypeAlterReactionTest.php | 2 +-
 tests/src/Functional/MediaSourceUpdateTest.php       | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/src/Functional/DeleteNodeWithMediaAndFile.php b/tests/src/Functional/DeleteNodeWithMediaAndFile.php
index 40e469c5..5ee19b7c 100644
--- a/tests/src/Functional/DeleteNodeWithMediaAndFile.php
+++ b/tests/src/Functional/DeleteNodeWithMediaAndFile.php
@@ -42,8 +42,8 @@ class DeleteNodeWithMediaAndFile extends IslandoraFunctionalTestBase {
       'uri' => "public://test.jpeg",
       'filename' => "test.jpeg",
       'filemime' => "image/jpeg",
-      'status' => FILE_STATUS_PERMANENT,
     ]);
+    $file->setPermanent();
     $file->save();
 
     $this->drupalGet("node/1/delete");
diff --git a/tests/src/Functional/IslandoraFunctionalTestBase.php b/tests/src/Functional/IslandoraFunctionalTestBase.php
index 2e723561..016788d0 100644
--- a/tests/src/Functional/IslandoraFunctionalTestBase.php
+++ b/tests/src/Functional/IslandoraFunctionalTestBase.php
@@ -438,8 +438,8 @@ EOD;
         'uri' => "public://test_file.txt",
         'filename' => "test_file.txt",
         'filemime' => "text/plain",
-        'status' => FILE_STATUS_PERMANENT,
       ]);
+    $file->setPermanent();
     $file->save();
 
     // Get the source field for the media.
diff --git a/tests/src/Functional/IslandoraImageFormatterTest.php b/tests/src/Functional/IslandoraImageFormatterTest.php
index 84ea5517..1b40f7a8 100644
--- a/tests/src/Functional/IslandoraImageFormatterTest.php
+++ b/tests/src/Functional/IslandoraImageFormatterTest.php
@@ -59,8 +59,8 @@ class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase {
       'uri' => "public://test.jpeg",
       'filename' => "test.jpeg",
       'filemime' => "image/jpeg",
-      'status' => FILE_STATUS_PERMANENT,
     ]);
+    $file->setPermanent();
     $file->save();
 
     // Make the media, and associate it with the image and node.
diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php
index 80a6039c..658244ae 100644
--- a/tests/src/Functional/JsonldTypeAlterReactionTest.php
+++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php
@@ -30,7 +30,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
       'new_storage_type' => 'string',
       'label' => 'Typed Predicate',
       'field_name' => 'type_predicate',
-    ], $this->t('Save and continue'));
+    ], 'Save and continue');
     $this->submitForm([], $this->t('Save field settings'));
     $this->submitForm([], $this->t('Save settings'));
     $this->assertSession()->responseContains('field_type_predicate');
diff --git a/tests/src/Functional/MediaSourceUpdateTest.php b/tests/src/Functional/MediaSourceUpdateTest.php
index 3c97c695..3938e9b4 100644
--- a/tests/src/Functional/MediaSourceUpdateTest.php
+++ b/tests/src/Functional/MediaSourceUpdateTest.php
@@ -52,8 +52,8 @@ class MediaSourceUpdateTest extends IslandoraFunctionalTestBase {
       'uri' => "public://test_file.txt",
       'filename' => "test_file.txt",
       'filemime' => "text/plain",
-      'status' => FILE_STATUS_PERMANENT,
     ]);
+    $this->file->setPermanent();
     $this->file->save();
 
     // Get the source field for the media.

From 621b7a2c7d074cb98b99d1581a8e179c0a403a31 Mon Sep 17 00:00:00 2001
From: Rosie Le Faive <lefaive@gmail.com>
Date: Fri, 30 Jun 2023 10:30:47 -0300
Subject: [PATCH 64/64] Remove duplicate line.

---
 tests/src/Kernel/EventGeneratorTest.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/src/Kernel/EventGeneratorTest.php b/tests/src/Kernel/EventGeneratorTest.php
index a9c1f082..28a4ec03 100644
--- a/tests/src/Kernel/EventGeneratorTest.php
+++ b/tests/src/Kernel/EventGeneratorTest.php
@@ -116,7 +116,6 @@ class EventGeneratorTest extends IslandoraKernelTestBase {
       ['event' => 'delete', 'queue' => 'islandora-indexing-fcrepo-delete']
     );
     $msg = json_decode($json, TRUE);
-    $msg = json_decode($json, TRUE);
 
     $this->assertBasicStructure($msg);
     $this->assertTrue($msg["type"] == "Delete", "Event must be of type 'Delete'.");