Compare commits

..

No commits in common. '2.x' and 'MNPALS-2.x' have entirely different histories.

  1. 54
      .github/workflows/build-2.x.yml
  2. 26
      .github/workflows/gitlab-mirror.yml
  3. 10
      composer.json
  4. 1
      config/install/islandora.settings.yml
  5. 6
      config/schema/islandora.schema.yml
  6. 38
      islandora.info.yml
  7. 14
      islandora.install
  8. 24
      islandora.module
  9. 3
      islandora.tokens.inc
  10. 4
      modules/islandora_advanced_search/islandora_advanced_search.info.yml
  11. 2
      modules/islandora_advanced_search/src/Form/AdvancedSearchForm.php
  12. 2
      modules/islandora_advanced_search/src/Plugin/Block/AdvancedSearchBlock.php
  13. 2
      modules/islandora_advanced_search/src/Plugin/Block/SearchResultsPagerBlock.php
  14. 3
      modules/islandora_audio/islandora_audio.info.yml
  15. 6
      modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
  16. 3
      modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml
  17. 0
      modules/islandora_core_feature/config/install/core.entity_view_mode.media.source.yml
  18. 100
      modules/islandora_core_feature/config/install/features.bundle.islandora.yml
  19. 0
      modules/islandora_core_feature/config/install/field.field.taxonomy_term.islandora_media_use.field_external_uri.yml
  20. 0
      modules/islandora_core_feature/config/install/field.field.taxonomy_term.islandora_models.field_external_uri.yml
  21. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_file_size.yml
  22. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_height.yml
  23. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_media_audio_file.yml
  24. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_media_document.yml
  25. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_media_file.yml
  26. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_media_image.yml
  27. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_media_of.yml
  28. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_media_use.yml
  29. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_media_video_file.yml
  30. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_mime_type.yml
  31. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_original_name.yml
  32. 0
      modules/islandora_core_feature/config/install/field.storage.media.field_width.yml
  33. 0
      modules/islandora_core_feature/config/install/field.storage.node.field_member_of.yml
  34. 0
      modules/islandora_core_feature/config/install/field.storage.node.field_model.yml
  35. 0
      modules/islandora_core_feature/config/install/field.storage.node.field_weight.yml
  36. 0
      modules/islandora_core_feature/config/install/field.storage.taxonomy_term.field_external_uri.yml
  37. 0
      modules/islandora_core_feature/config/install/filehash.settings.yml
  38. 0
      modules/islandora_core_feature/config/install/migrate_plus.migration.islandora_tags.yml
  39. 0
      modules/islandora_core_feature/config/install/migrate_plus.migration_group.islandora.yml
  40. 0
      modules/islandora_core_feature/config/install/rest.resource.entity.file.yml
  41. 0
      modules/islandora_core_feature/config/install/rest.resource.entity.media.yml
  42. 0
      modules/islandora_core_feature/config/install/rest.resource.entity.node.yml
  43. 0
      modules/islandora_core_feature/config/install/rest.resource.entity.taxonomy_term.yml
  44. 0
      modules/islandora_core_feature/config/install/system.action.delete_file_as_fedora_external_content.yml
  45. 0
      modules/islandora_core_feature/config/install/system.action.delete_media_from_triplestore.yml
  46. 0
      modules/islandora_core_feature/config/install/system.action.delete_node_from_fedora.yml
  47. 0
      modules/islandora_core_feature/config/install/system.action.delete_node_from_triplestore.yml
  48. 0
      modules/islandora_core_feature/config/install/system.action.delete_taxonomy_term_in_fedora.yml
  49. 0
      modules/islandora_core_feature/config/install/system.action.delete_taxonomy_term_in_triplestore.yml
  50. 0
      modules/islandora_core_feature/config/install/system.action.index_file_as_fedora_external_content.yml
  51. 0
      modules/islandora_core_feature/config/install/system.action.index_media_in_fedora.yml
  52. 0
      modules/islandora_core_feature/config/install/system.action.index_media_in_triplestore.yml
  53. 0
      modules/islandora_core_feature/config/install/system.action.index_node_in_fedora.yml
  54. 0
      modules/islandora_core_feature/config/install/system.action.index_node_in_triplestore.yml
  55. 0
      modules/islandora_core_feature/config/install/system.action.index_taxonomy_term_in_fedora.yml
  56. 0
      modules/islandora_core_feature/config/install/system.action.index_taxonomy_term_in_the_triplestore.yml
  57. 0
      modules/islandora_core_feature/config/install/taxonomy.vocabulary.islandora_media_use.yml
  58. 0
      modules/islandora_core_feature/config/install/taxonomy.vocabulary.islandora_models.yml
  59. 0
      modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml
  60. 0
      modules/islandora_core_feature/config/install/views.view.display_media.yml
  61. 0
      modules/islandora_core_feature/config/install/views.view.file_checksum.yml
  62. 0
      modules/islandora_core_feature/config/install/views.view.manage_members.yml
  63. 0
      modules/islandora_core_feature/config/install/views.view.media_of.yml
  64. 0
      modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml
  65. 0
      modules/islandora_core_feature/config/install/views.view.reorder_children.yml
  66. 16
      modules/islandora_core_feature/islandora_core_feature.features.yml
  67. 4
      modules/islandora_core_feature/islandora_core_feature.info.yml
  68. 18
      modules/islandora_iiif/config/schema/islandora_iiif.schema.yml
  69. 3
      modules/islandora_iiif/islandora_iiif.info.yml
  70. 26
      modules/islandora_iiif/src/Form/IslandoraIIIFConfigForm.php
  71. 183
      modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
  72. 3
      modules/islandora_image/islandora_image.info.yml
  73. 6
      modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
  74. 3
      modules/islandora_text_extraction/islandora_text_extraction.info.yml
  75. 5
      modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php
  76. 5
      modules/islandora_text_extraction/src/Plugin/Field/FieldFormatter/OcrTextFormatter.php
  77. 0
      modules/islandora_text_extraction_defaults/config/install/core.entity_form_display.media.extracted_text.default.yml
  78. 0
      modules/islandora_text_extraction_defaults/config/install/core.entity_view_display.media.extracted_text.default.yml
  79. 0
      modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_edited_text.yml
  80. 0
      modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_file.yml
  81. 0
      modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_of.yml
  82. 0
      modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_use.yml
  83. 0
      modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_mime_type.yml
  84. 0
      modules/islandora_text_extraction_defaults/config/install/field.storage.media.field_edited_text.yml
  85. 0
      modules/islandora_text_extraction_defaults/config/install/language.content_settings.media.extracted_text.yml
  86. 0
      modules/islandora_text_extraction_defaults/config/install/media.type.extracted_text.yml
  87. 0
      modules/islandora_text_extraction_defaults/config/install/rdf.mapping.media.extracted_text.yml
  88. 0
      modules/islandora_text_extraction_defaults/config/install/system.action.get_ocr_from_image.yml
  89. 2
      modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.features.yml
  90. 3
      modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.info.yml
  91. 3
      modules/islandora_video/islandora_video.info.yml
  92. 6
      modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
  93. 2
      phpunit.xml
  94. 2
      src/Controller/ManageMembersController.php
  95. 16
      src/EventGenerator/EventGenerator.php
  96. 20
      src/Flysystem/Adapter/FedoraAdapter.php
  97. 10
      src/Form/ConfirmDeleteMediaAndFile.php
  98. 25
      src/Form/IslandoraSettingsForm.php
  99. 2
      src/IslandoraContextManager.php
  100. 6
      src/Plugin/Condition/NodeHasParent.php
  101. Some files were not shown because too many files have changed in this diff Show More

54
.github/workflows/build-2.x.yml

@ -1,33 +1,36 @@
# This is a basic workflow to help you get started with Actions
name: CI name: CI
# Controls when the action will run.
on: on:
# Triggers the workflow on push or pull request events but only for the 2.x branch
push: push:
branches: [ 2.x ] branches: [ 2.x ]
pull_request: pull_request:
branches: [ 2.x ] branches: [ 2.x ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs: jobs:
# This workflow contains a single job called "build"
build: build:
env: # The type of runner that the job will run on
DRUPAL_VERSION: ${{ matrix.drupal-version }}
SCRIPT_DIR: ${{ github.workspace }}/islandora_ci
DRUPAL_DIR: /opt/drupal
PHPUNIT_FILE: ${{ github.workspace }}/build_dir/phpunit.xml
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allowed_failure }} continue-on-error: ${{ matrix.allowed_failure }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ["8.1", "8.2", "8.3"] # PHP 8.1 fails - see https://github.com/Islandora/islandora/issues/887
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"] test-suite: ["kernel", "functional", "functional-javascript"]
drupal-version: ["10.1.x", "10.2.x", "10.3.x-dev"] # Not yet Drupal 10 ready - see https://github.com/Islandora/islandora/issues/888
drupal-version: ["9.4.x", "9.5.x"]
mysql: ["8.0"] mysql: ["8.0"]
allowed_failure: [false] allowed_failure: [false]
exclude:
- php-versions: "8.3"
drupal-version: "10.1.x"
name: PHP ${{ matrix.php-versions }} | drupal ${{ matrix.drupal-version }} | mysql ${{ matrix.mysql }} | test-suite ${{ matrix.test-suite }} name: PHP ${{ matrix.php-versions }} | drupal ${{ matrix.drupal-version }} | mysql ${{ matrix.mysql }} | test-suite ${{ matrix.test-suite }}
@ -47,15 +50,17 @@ jobs:
- 61616:61616 - 61616:61616
- 61613:61613 - 61613:61613
# Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
path: build_dir path: build_dir
- name: Checkout islandora_ci - name: Checkout islandora_ci
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
repository: islandora/islandora_ci repository: islandora/islandora_ci
ref: github-actions ref: github-actions
@ -73,8 +78,15 @@ jobs:
sudo apt-get remove -y mysql-client mysql-common sudo apt-get remove -y mysql-client mysql-common
sudo apt-get install -y mysql-client sudo apt-get install -y mysql-client
- name: Set environment variables
run: |
echo "DRUPAL_VERSION=${{ matrix.drupal-version }}" >> $GITHUB_ENV
echo "SCRIPT_DIR=$GITHUB_WORKSPACE/islandora_ci" >> $GITHUB_ENV
echo "DRUPAL_DIR=/opt/drupal" >> $GITHUB_ENV
echo "PHPUNIT_FILE=$GITHUB_WORKSPACE/build_dir/phpunit.xml" >> $GITHUB_ENV
- name: Cache Composer dependencies - name: Cache Composer dependencies
uses: actions/cache@v3 uses: actions/cache@v2
with: with:
path: /tmp/composer-cache path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
@ -99,27 +111,15 @@ jobs:
run: | run: |
cd $DRUPAL_DIR/web cd $DRUPAL_DIR/web
drush --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults drush --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults
drush --uri=127.0.0.1:8282 fim -y islandora_core_feature,islandora_text_extraction_defaults
- name: Copy PHPunit file - name: Copy PHPunit file
run: cp $PHPUNIT_FILE $DRUPAL_DIR/web/core/phpunit.xml run: cp $PHPUNIT_FILE $DRUPAL_DIR/web/core/phpunit.xml
- name: Test scripts - name: Test scripts
run: $SCRIPT_DIR/travis_scripts.sh run: $SCRIPT_DIR/travis_scripts.sh
- name: Start chromedriver
if: matrix.test-suite == 'functional-javascript'
run: |-
/usr/local/share/chromedriver-linux64/chromedriver \
--log-path=/tmp/chromedriver.log \
--verbose \
--allowed-ips= \
--allowed-origins=* &
- name: PHPUNIT tests - name: PHPUNIT tests
run: | run: |
cd $DRUPAL_DIR/web/core cd $DRUPAL_DIR/web/core
$DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}" $DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}"
- name: Print chromedriver logs
if: matrix.test-suite == 'functional-javascript'
run: cat /tmp/chromedriver.log

26
.github/workflows/gitlab-mirror.yml

@ -1,26 +0,0 @@
name: Mirror and run GitLab CI
on:
push:
branches: [2.x]
tags: '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Mirror + trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://git.drupalcode.org/project/islandora"
env:
FOLLOW_TAGS: "true"
FORCE_PUSH: "false"
GITLAB_HOSTNAME: "git.drupal.org"
GITLAB_USERNAME: "project_34868_bot"
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "34868"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

10
composer.json

@ -14,11 +14,12 @@
} }
], ],
"require": { "require": {
"drupal/context": "^4 || ^5@RC", "drupal/context": "^4",
"drupal/ctools": "^3.8 || ^4", "drupal/ctools": "^3.8 || ^4",
"drupal/eva" : "^3.0", "drupal/eva" : "^3.0",
"drupal/features" : "^3.7",
"drupal/file_replace": "^1.1", "drupal/file_replace": "^1.1",
"drupal/filehash": "^2 || ^3", "drupal/filehash": "^2",
"drupal/flysystem" : "^2.0@alpha", "drupal/flysystem" : "^2.0@alpha",
"drupal/jwt": "^1.1 || ^2", "drupal/jwt": "^1.1 || ^2",
"drupal/migrate_plus" : "^5.1 || ^6", "drupal/migrate_plus" : "^5.1 || ^6",
@ -28,7 +29,7 @@
"drupal/token" : "^1.3", "drupal/token" : "^1.3",
"islandora/chullo": "^2.0", "islandora/chullo": "^2.0",
"islandora/fedora-entity-mapper": "^1.0", "islandora/fedora-entity-mapper": "^1.0",
"islandora/jsonld": "^2 || ^3", "islandora/jsonld": "^2",
"stomp-php/stomp-php": "4.* || ^5" "stomp-php/stomp-php": "4.* || ^5"
}, },
"require-dev": { "require-dev": {
@ -38,8 +39,7 @@
"sebastian/phpcpd": "*" "sebastian/phpcpd": "*"
}, },
"suggest": { "suggest": {
"drupal/transliterate_filenames": "Sanitizes filenames when they are uploaded so they don't break your repository.", "drupal/transliterate_filenames": "Sanitizes filenames when they are uploaded so they don't break your repository."
"drupal/coi": "Some configuration fields work with Config Override Inspector."
}, },
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
"authors": [ "authors": [

1
config/install/islandora.settings.yml

@ -1,4 +1,5 @@
broker_url: 'tcp://localhost:61613' broker_url: 'tcp://localhost:61613'
jwt_expiry: '+2 hour' jwt_expiry: '+2 hour'
gemini_url: ''
delete_media_and_files: TRUE delete_media_and_files: TRUE
gemini_pseudo_bundles: [] gemini_pseudo_bundles: []

6
config/schema/islandora.schema.yml

@ -17,15 +17,15 @@ islandora.settings:
delete_media_and_files: delete_media_and_files:
type: boolean type: boolean
label: 'Node Delete with Media and Files' label: 'Node Delete with Media and Files'
redirect_after_media_save:
type: boolean
label: 'Redirect to node after media save.'
upload_form_location: upload_form_location:
type: string type: string
label: 'Upload Form Location' label: 'Upload Form Location'
upload_form_allowed_mimetypes: upload_form_allowed_mimetypes:
type: string type: string
label: 'Upload Form Allowed Extensions' label: 'Upload Form Allowed Extensions'
gemini_url:
type: uri
label: 'Url to Gemini microservice'
gemini_pseudo_bundles: gemini_pseudo_bundles:
type: sequence type: sequence
label: 'List of node, media and taxonomy terms that should include the linked Fedora URI' label: 'List of node, media and taxonomy terms that should include the linked Fedora URI'

38
islandora.info.yml

@ -4,30 +4,32 @@ name: 'islandora'
description: "Islandora Core" description: "Islandora Core"
type: module type: module
package: Islandora package: Islandora
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
dependencies: dependencies:
- context:context_ui
- ctools:ctools
- drupal:action
- drupal:basic_auth
- drupal:block - drupal:block
- drupal:content_translation
- drupal:link
- drupal:media
- drupal:node - drupal:node
- drupal:options
- drupal:path - drupal:path
- drupal:rest
- drupal:taxonomy
- drupal:text - drupal:text
- drupal:views_ui - drupal:options
- eva:eva - drupal:link
- file_replace:file_replace
- filehash:filehash
- flysystem:flysystem
- jsonld:jsonld - jsonld:jsonld
- search_api:search_api
- jwt:jwt - jwt:jwt
- migrate_source_csv:migrate_source_csv - drupal:rest
- filehash:filehash
- drupal:basic_auth
- context:context_ui
- drupal:action
- eva:eva
- drupal:taxonomy
- drupal:views_ui
- drupal:media
- prepopulate:prepopulate - prepopulate:prepopulate
- search_api:search_api - features:features_ui
- migrate_source_csv:migrate_source_csv
- drupal:content_translation
- flysystem:flysystem
- token:token - token:token
- file_replace:file_replace
- ctools:ctools

14
islandora.install

@ -212,17 +212,3 @@ function islandora_update_8007() {
// have the here, just in case? // have the here, just in case?
throw new UpdateException('Failed; hit the end of the update hook implementation, which is not expected.'); throw new UpdateException('Failed; hit the end of the update hook implementation, which is not expected.');
} }
/**
* Set config to no redirect after media save.
*/
function islandora_update_8008() {
$config = \Drupal::configFactory()->getEditable('islandora.settings');
if ($config) {
$config->set('redirect_after_media_save', FALSE);
$config->save(TRUE);
return t('A new configuration option, "Redirect after media save" is now available.
It has been turned off to preserve existing behaviour. To enable this setting visit
Configuration > Islandora > Core Settings.');
}
}

24
islandora.module

@ -332,7 +332,6 @@ function islandora_form_alter(&$form, FormStateInterface $form_state, $form_id)
if ($node) { if ($node) {
$form['name']['widget'][0]['value']['#default_value'] = $node->getTitle(); $form['name']['widget'][0]['value']['#default_value'] = $node->getTitle();
} }
$form['actions']['submit']['#submit'][] = 'islandora_media_custom_form_submit';
} }
} }
@ -388,22 +387,6 @@ function islandora_form_alter(&$form, FormStateInterface $form_state, $form_id)
return $form; return $form;
} }
/**
* Redirect submit handler for media save.
*/
function islandora_media_custom_form_submit(&$form, FormStateInterface $form_state) {
// Check configuration to see whether a redirect is desired.
$redirect = \Drupal::config('islandora.settings')->get('redirect_after_media_save');
if ($redirect) {
$params = \Drupal::request()->query->all();
if (!empty($params)) {
$target_id = $params['edit']['field_media_of']['widget'][0]['target_id'];
$url = Url::fromRoute('view.media_of.page_1', ['node' => $target_id]);
$form_state->setRedirectUrl($url);
}
}
}
/** /**
* Implements a submit handler for the delete form. * Implements a submit handler for the delete form.
*/ */
@ -545,14 +528,14 @@ function islandora_object_delete_form_submit($form, FormStateInterface $form_sta
} }
/** /**
* Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter(). * Implements hook_field_widget_WIDGET_TYPE_form_alter().
*/ */
function islandora_field_widget_single_element_image_image_form_alter(&$element, $form_state, $context) { function islandora_field_widget_image_image_form_alter(&$element, $form_state, $context) {
$element['#process'][] = 'islandora_add_default_image_alt_text'; $element['#process'][] = 'islandora_add_default_image_alt_text';
} }
/** /**
* Callback for hook_field_widget_single_element_WIDGET_TYPE_form_alter(). * Callback for hook_field_widget_WIDGET_TYPE_form_alter().
*/ */
function islandora_add_default_image_alt_text($element, $form_state, $form) { function islandora_add_default_image_alt_text($element, $form_state, $form) {
if ($element['alt']['#access']) { if ($element['alt']['#access']) {
@ -615,7 +598,6 @@ function islandora_form_block_form_alter(&$form, FormStateInterface $form_state,
unset($form['visibility']['media_is_islandora_media']); unset($form['visibility']['media_is_islandora_media']);
unset($form['visibility']['media_uses_filesystem']); unset($form['visibility']['media_uses_filesystem']);
unset($form['visibility']['node_had_namespace']); unset($form['visibility']['node_had_namespace']);
unset($form['visibility']['node_has_ancestor']);
unset($form['visibility']['node_has_parent']); unset($form['visibility']['node_has_parent']);
unset($form['visibility']['node_has_term']); unset($form['visibility']['node_has_term']);
unset($form['visibility']['node_is_islandora_object']); unset($form['visibility']['node_is_islandora_object']);

3
islandora.tokens.inc

@ -134,7 +134,7 @@ function islandora_tokens($type, $tokens, array $data, array $options, Bubbleabl
break; break;
case 'pdf_url': case 'pdf_url':
$replacements[$original] = islandora_url_to_service_file_media_by_mimetype($data['node'], 'application/pdf'); $replacements[$original] = ' ' . islandora_url_to_service_file_media_by_mimetype($data['node'], 'application/pdf');
break; break;
} }
} }
@ -188,5 +188,4 @@ function islandora_url_to_service_file_media_by_mimetype($node, $mime_type) {
} }
} }
} }
return '';
} }

4
modules/islandora_advanced_search/islandora_advanced_search.info.yml

@ -4,10 +4,8 @@ name: 'Islandora Advanced Search'
description: "Creates an Advanced Search block and other enhancements to search." description: "Creates an Advanced Search block and other enhancements to search."
type: module type: module
package: Islandora package: Islandora
core_version_requirement: ^9 || ^10 core_version_requirement: ^8 || ^9
dependencies: dependencies:
- drupal:facets - drupal:facets
- drupal:facets_summary - drupal:facets_summary
- drupal:search_api_solr - drupal:search_api_solr
lifecycle: deprecated
lifecycle_link: https://groups.google.com/g/islandora/c/SEOAWJrfE_M

2
modules/islandora_advanced_search/src/Form/AdvancedSearchForm.php

@ -71,7 +71,7 @@ class AdvancedSearchForm extends FormBase {
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('request_stack')->getMainRequest(), $container->get('request_stack')->getMasterRequest(),
$container->get('current_route_match') $container->get('current_route_match')
); );
} }

2
modules/islandora_advanced_search/src/Plugin/Block/AdvancedSearchBlock.php

@ -108,7 +108,7 @@ class AdvancedSearchBlock extends BlockBase implements ContainerFactoryPluginInt
$plugin_definition, $plugin_definition,
$container->get('plugin.manager.search_api.display'), $container->get('plugin.manager.search_api.display'),
$container->get('form_builder'), $container->get('form_builder'),
$container->get('request_stack')->getMainRequest() $container->get('request_stack')->getMasterRequest()
); );
} }

2
modules/islandora_advanced_search/src/Plugin/Block/SearchResultsPagerBlock.php

@ -58,7 +58,7 @@ class SearchResultsPagerBlock extends BlockBase implements ContainerFactoryPlugi
$configuration, $configuration,
$plugin_id, $plugin_id,
$plugin_definition, $plugin_definition,
$container->get('request_stack')->getMainRequest() $container->get('request_stack')->getMasterRequest()
); );
} }

3
modules/islandora_audio/islandora_audio.info.yml

@ -2,6 +2,7 @@ name: 'Islandora Audio'
description: 'Islandora audio derivative actions' description: 'Islandora audio derivative actions'
type: module type: module
package: Islandora package: Islandora
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
dependencies: dependencies:
- drupal:islandora - drupal:islandora

6
modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php

@ -40,7 +40,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
// Create an action to generate a audio derivative. // Create an action to generate a audio derivative.
$this->drupalGet('admin/config/system/actions'); $this->drupalGet('admin/config/system/actions');
$this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a audio derivative"); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a audio derivative");
$this->getSession()->getPage()->pressButton('Create'); $this->getSession()->getPage()->pressButton($this->t('Create'));
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
$this->getSession()->getPage()->fillField('edit-label', "Generate audio test derivative"); $this->getSession()->getPage()->fillField('edit-label', "Generate audio test derivative");
@ -53,7 +53,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
$this->getSession()->getPage()->fillField('edit-args', "-f mp3"); $this->getSession()->getPage()->fillField('edit-args', "-f mp3");
$this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-scheme', "public");
$this->getSession()->getPage()->fillField('edit-path', "derp.mov"); $this->getSession()->getPage()->fillField('edit-path', "derp.mov");
$this->getSession()->getPage()->pressButton('Save'); $this->getSession()->getPage()->pressButton($this->t('Save'));
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Create a context and add the action as a derivative reaction. // Create a context and add the action as a derivative reaction.
@ -69,7 +69,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
]; ];
$this->drupalGet('media/add/' . $this->testMediaType->id()); $this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, 'Save'); $this->submitForm($values, $this->t('Save'));
$expected = [ $expected = [
'source_uri' => 'test_file.txt', 'source_uri' => 'test_file.txt',

3
modules/islandora_breadcrumbs/islandora_breadcrumbs.info.yml

@ -1,7 +1,8 @@
name: 'Islandora Breadcrumbs' name: 'Islandora Breadcrumbs'
type: module type: module
description: 'Builds breadcrumbs based on field_member_of relationships.' description: 'Builds breadcrumbs based on field_member_of relationships.'
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
package: Islandora package: Islandora
dependencies: dependencies:
- islandora:islandora - islandora:islandora

0
modules/islandora_core_feature/config/optional/core.entity_view_mode.media.source.yml → modules/islandora_core_feature/config/install/core.entity_view_mode.media.source.yml

100
modules/islandora_core_feature/config/install/features.bundle.islandora.yml

@ -0,0 +1,100 @@
langcode: en
status: true
dependencies:
enforced:
module:
- islandora_core_feature
name: Islandora
machine_name: islandora
description: 'Features for islandora'
assignments:
alter:
core: true
uuid: true
user_permissions: true
enabled: true
weight: 0
base:
types:
config:
comment_type: comment_type
node_type: node_type
content:
user: user
enabled: true
weight: -2
core:
types:
config:
date_format: date_format
field_storage_config: field_storage_config
entity_form_mode: entity_form_mode
image_style: image_style
menu: menu
responsive_image_style: responsive_image_style
user_role: user_role
entity_view_mode: entity_view_mode
enabled: true
weight: 5
dependency:
enabled: true
weight: 15
exclude:
types:
config:
features_bundle: features_bundle
curated: true
module:
installed: true
profile: true
namespace: true
namespace_any: false
enabled: true
weight: -5
existing:
enabled: true
weight: 12
forward_dependency:
enabled: true
weight: 4
namespace:
enabled: true
weight: 0
optional:
types:
config: { }
enabled: true
weight: 0
packages:
enabled: true
weight: -20
profile:
curated: true
standard:
files: true
dependencies: true
types:
config:
block: block
language_content_settings: language_content_settings
configurable_language: configurable_language
migration: migration
shortcut_set: shortcut_set
tour: tour
enabled: true
weight: 10
site:
types:
config:
action: action
contact_form: contact_form
block_content_type: block_content_type
rdf_mapping: rdf_mapping
search_page: search_page
taxonomy_vocabulary: taxonomy_vocabulary
editor: editor
filter_format: filter_format
enabled: true
weight: 7
profile_name: ''
is_profile: false

0
modules/islandora_core_feature/config/optional/field.field.taxonomy_term.islandora_media_use.field_external_uri.yml → modules/islandora_core_feature/config/install/field.field.taxonomy_term.islandora_media_use.field_external_uri.yml

0
modules/islandora_core_feature/config/optional/field.field.taxonomy_term.islandora_models.field_external_uri.yml → modules/islandora_core_feature/config/install/field.field.taxonomy_term.islandora_models.field_external_uri.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_file_size.yml → modules/islandora_core_feature/config/install/field.storage.media.field_file_size.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_height.yml → modules/islandora_core_feature/config/install/field.storage.media.field_height.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_media_audio_file.yml → modules/islandora_core_feature/config/install/field.storage.media.field_media_audio_file.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_media_document.yml → modules/islandora_core_feature/config/install/field.storage.media.field_media_document.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_media_file.yml → modules/islandora_core_feature/config/install/field.storage.media.field_media_file.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_media_image.yml → modules/islandora_core_feature/config/install/field.storage.media.field_media_image.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_media_of.yml → modules/islandora_core_feature/config/install/field.storage.media.field_media_of.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_media_use.yml → modules/islandora_core_feature/config/install/field.storage.media.field_media_use.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_media_video_file.yml → modules/islandora_core_feature/config/install/field.storage.media.field_media_video_file.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_mime_type.yml → modules/islandora_core_feature/config/install/field.storage.media.field_mime_type.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_original_name.yml → modules/islandora_core_feature/config/install/field.storage.media.field_original_name.yml

0
modules/islandora_core_feature/config/optional/field.storage.media.field_width.yml → modules/islandora_core_feature/config/install/field.storage.media.field_width.yml

0
modules/islandora_core_feature/config/optional/field.storage.node.field_member_of.yml → modules/islandora_core_feature/config/install/field.storage.node.field_member_of.yml

0
modules/islandora_core_feature/config/optional/field.storage.node.field_model.yml → modules/islandora_core_feature/config/install/field.storage.node.field_model.yml

0
modules/islandora_core_feature/config/optional/field.storage.node.field_weight.yml → modules/islandora_core_feature/config/install/field.storage.node.field_weight.yml

0
modules/islandora_core_feature/config/optional/field.storage.taxonomy_term.field_external_uri.yml → modules/islandora_core_feature/config/install/field.storage.taxonomy_term.field_external_uri.yml

0
modules/islandora_core_feature/config/optional/filehash.settings.yml → modules/islandora_core_feature/config/install/filehash.settings.yml

0
modules/islandora_core_feature/config/optional/migrate_plus.migration.islandora_tags.yml → modules/islandora_core_feature/config/install/migrate_plus.migration.islandora_tags.yml

0
modules/islandora_core_feature/config/optional/migrate_plus.migration_group.islandora.yml → modules/islandora_core_feature/config/install/migrate_plus.migration_group.islandora.yml

0
modules/islandora_core_feature/config/optional/rest.resource.entity.file.yml → modules/islandora_core_feature/config/install/rest.resource.entity.file.yml

0
modules/islandora_core_feature/config/optional/rest.resource.entity.media.yml → modules/islandora_core_feature/config/install/rest.resource.entity.media.yml

0
modules/islandora_core_feature/config/optional/rest.resource.entity.node.yml → modules/islandora_core_feature/config/install/rest.resource.entity.node.yml

0
modules/islandora_core_feature/config/optional/rest.resource.entity.taxonomy_term.yml → modules/islandora_core_feature/config/install/rest.resource.entity.taxonomy_term.yml

0
modules/islandora_core_feature/config/optional/system.action.delete_file_as_fedora_external_content.yml → modules/islandora_core_feature/config/install/system.action.delete_file_as_fedora_external_content.yml

0
modules/islandora_core_feature/config/optional/system.action.delete_media_from_triplestore.yml → modules/islandora_core_feature/config/install/system.action.delete_media_from_triplestore.yml

0
modules/islandora_core_feature/config/optional/system.action.delete_node_from_fedora.yml → modules/islandora_core_feature/config/install/system.action.delete_node_from_fedora.yml

0
modules/islandora_core_feature/config/optional/system.action.delete_node_from_triplestore.yml → modules/islandora_core_feature/config/install/system.action.delete_node_from_triplestore.yml

0
modules/islandora_core_feature/config/optional/system.action.delete_taxonomy_term_in_fedora.yml → modules/islandora_core_feature/config/install/system.action.delete_taxonomy_term_in_fedora.yml

0
modules/islandora_core_feature/config/optional/system.action.delete_taxonomy_term_in_triplestore.yml → modules/islandora_core_feature/config/install/system.action.delete_taxonomy_term_in_triplestore.yml

0
modules/islandora_core_feature/config/optional/system.action.index_file_as_fedora_external_content.yml → modules/islandora_core_feature/config/install/system.action.index_file_as_fedora_external_content.yml

0
modules/islandora_core_feature/config/optional/system.action.index_media_in_fedora.yml → modules/islandora_core_feature/config/install/system.action.index_media_in_fedora.yml

0
modules/islandora_core_feature/config/optional/system.action.index_media_in_triplestore.yml → modules/islandora_core_feature/config/install/system.action.index_media_in_triplestore.yml

0
modules/islandora_core_feature/config/optional/system.action.index_node_in_fedora.yml → modules/islandora_core_feature/config/install/system.action.index_node_in_fedora.yml

0
modules/islandora_core_feature/config/optional/system.action.index_node_in_triplestore.yml → modules/islandora_core_feature/config/install/system.action.index_node_in_triplestore.yml

0
modules/islandora_core_feature/config/optional/system.action.index_taxonomy_term_in_fedora.yml → modules/islandora_core_feature/config/install/system.action.index_taxonomy_term_in_fedora.yml

0
modules/islandora_core_feature/config/optional/system.action.index_taxonomy_term_in_the_triplestore.yml → modules/islandora_core_feature/config/install/system.action.index_taxonomy_term_in_the_triplestore.yml

0
modules/islandora_core_feature/config/optional/taxonomy.vocabulary.islandora_media_use.yml → modules/islandora_core_feature/config/install/taxonomy.vocabulary.islandora_media_use.yml

0
modules/islandora_core_feature/config/optional/taxonomy.vocabulary.islandora_models.yml → modules/islandora_core_feature/config/install/taxonomy.vocabulary.islandora_models.yml

0
modules/islandora_core_feature/config/optional/views.view.all_taxonomy_terms.yml → modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml

0
modules/islandora_core_feature/config/optional/views.view.display_media.yml → modules/islandora_core_feature/config/install/views.view.display_media.yml

0
modules/islandora_core_feature/config/optional/views.view.file_checksum.yml → modules/islandora_core_feature/config/install/views.view.file_checksum.yml

0
modules/islandora_core_feature/config/optional/views.view.manage_members.yml → modules/islandora_core_feature/config/install/views.view.manage_members.yml

0
modules/islandora_core_feature/config/optional/views.view.media_of.yml → modules/islandora_core_feature/config/install/views.view.media_of.yml

0
modules/islandora_core_feature/config/optional/views.view.non_fedora_files.yml → modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml

0
modules/islandora_core_feature/config/optional/views.view.reorder_children.yml → modules/islandora_core_feature/config/install/views.view.reorder_children.yml

16
modules/islandora_core_feature/islandora_core_feature.features.yml

@ -0,0 +1,16 @@
bundle: islandora
excluded:
- language.content_settings.taxonomy_term.islandora_media_use
- language.content_settings.taxonomy_term.islandora_models
required:
- features.bundle.islandora
- field.storage.media.field_file_size
- field.storage.media.field_height
- field.storage.media.field_media_of
- field.storage.media.field_media_use
- field.storage.media.field_mime_type
- field.storage.media.field_width
- field.storage.node.field_member_of
- field.storage.node.field_model
- field.storage.node.field_weight
- field.storage.taxonomy_term.field_external_uri

4
modules/islandora_core_feature/islandora_core_feature.info.yml

@ -1,11 +1,13 @@
name: 'Islandora Core Feature' name: 'Islandora Core Feature'
description: 'Minimum configuration required for Islandora.' description: 'Minimum configuration required for Islandora.'
type: module type: module
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
dependencies: dependencies:
- drupal:basic_auth - drupal:basic_auth
- drupal:content_translation - drupal:content_translation
- drupal:eva - drupal:eva
- drupal:features
- drupal:field - drupal:field
- drupal:file - drupal:file
- drupal:filehash - drupal:filehash

18
modules/islandora_iiif/config/schema/islandora_iiif.schema.yml

@ -5,29 +5,11 @@ islandora_iiif.settings:
iiif_server: iiif_server:
type: string type: string
label: 'IIIF Server Url' label: 'IIIF Server Url'
use_relative_paths:
type: boolean
label: 'Use relative paths in manifest.'
show_title:
type: string
label: 'Show title in view'
views.style.iiif_manifest: views.style.iiif_manifest:
type: views_style type: views_style
mapping: mapping:
iiif_tile_field: iiif_tile_field:
type: sequence type: sequence
label: "Tile source field(s)"
sequence:
type: string
iiif_ocr_file_field:
type: sequence
label: "Structured OCR data file field"
sequence: sequence:
type: string type: string
structured_text_term_uri:
type: string
label: "Structured text term"
search_endpoint:
type: string
label: "Search endpoint path"

3
modules/islandora_iiif/islandora_iiif.info.yml

@ -1,7 +1,8 @@
name: 'Islandora IIIF' name: 'Islandora IIIF'
type: module type: module
description: 'IIIF support for Islandora' description: 'IIIF support for Islandora'
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
package: Islandora package: Islandora
dependencies: dependencies:
- drupal:islandora - drupal:islandora

26
modules/islandora_iiif/src/Form/IslandoraIIIFConfigForm.php

@ -66,37 +66,13 @@ class IslandoraIIIFConfigForm extends ConfigFormBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildForm(array $form, FormStateInterface $form_state) { public function buildForm(array $form, FormStateInterface $form_state) {
$options = [
'none' => $this->t('None'),
'view' => $this->t("From view title"),
'node' => $this->t("From node title"),
];
$config = $this->config('islandora_iiif.settings'); $config = $this->config('islandora_iiif.settings');
$form['iiif_server'] = [ $form['iiif_server'] = [
'#type' => 'url', '#type' => 'url',
'#title' => $this->t('IIIF Image server location'), '#title' => $this->t('IIIF Image server location'),
'#description' => $this->t('Please enter the image server location without trailing slash. e.g. http://www.example.org/iiif/2.'), '#description' => $this->t('Please enter the image server location without trailing slash. e.g. http://www.example.org/iiif/2.'),
'#default_value' => $config->get('iiif_server'), '#default_value' => $config->get('iiif_server'),
'#config' => [
'key' => 'islandora_iiif.settings:iiif_server',
],
];
$form['use_relative_paths'] = [
'#type' => 'checkbox',
'#title' => $this->t("Use relative file paths in manifest."),
'#description' => $this->t("Check this if your IIIF Server is configured to access files locally. If unchecked, the absolute URL will be given and the IIIF server will make requests to this site to retrieve images."),
'#default_value' => $config->get('use_relative_paths'),
]; ];
$form['show_title'] = [
'#type' => 'select',
'#options' => $options,
'#title' => $this->t("Show title in viewer."),
'#description' => $this->t("Show title on your viewer, if viewer allows"),
'#default_value' => $config->get('show_title'),
];
return parent::buildForm($form, $form_state); return parent::buildForm($form, $form_state);
} }
@ -123,8 +99,6 @@ class IslandoraIIIFConfigForm extends ConfigFormBase {
$this->config('islandora_iiif.settings') $this->config('islandora_iiif.settings')
->set('iiif_server', $form_state->getValue('iiif_server')) ->set('iiif_server', $form_state->getValue('iiif_server'))
->set('use_relative_paths', $form_state->getValue('use_relative_paths'))
->set('show_title', $form_state->getValue('show_title'))
->save(); ->save();
} }

183
modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php

@ -5,14 +5,11 @@ namespace Drupal\islandora_iiif\Plugin\views\style;
use Drupal\Core\Config\ImmutableConfig; use Drupal\Core\Config\ImmutableConfig;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\File\FileSystemInterface; use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\islandora\IslandoraUtils;
use Drupal\taxonomy\TermInterface;
use Drupal\views\Plugin\views\style\StylePluginBase; use Drupal\views\Plugin\views\style\StylePluginBase;
use Drupal\views\ResultRow; use Drupal\views\ResultRow;
use GuzzleHttp\Client; use GuzzleHttp\Client;
@ -37,13 +34,6 @@ use Symfony\Component\HttpFoundation\Request;
*/ */
class IIIFManifest extends StylePluginBase { class IIIFManifest extends StylePluginBase {
/**
* Islandora utility functions.
*
* @var \Drupal\islandora\IslandoraUtils
*/
protected $utils;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -96,13 +86,6 @@ class IIIFManifest extends StylePluginBase {
*/ */
protected $fileSystem; protected $fileSystem;
/**
* The Guzzle HTTP Client.
*
* @var \GuzzleHttp\Client
*/
protected $httpClient;
/** /**
* The messenger. * The messenger.
* *
@ -117,24 +100,10 @@ class IIIFManifest extends StylePluginBase {
*/ */
protected $moduleHandler; protected $moduleHandler;
/**
* Memoized structured text term.
*
* @var \Drupal\taxonomy\TermInterface|null
*/
protected ?TermInterface $structuredTextTerm;
/**
* Flag to track if we _have_ attempted a lookup, as the value is nullable.
*
* @var bool
*/
protected bool $structuredTextTermMemoized = FALSE;
/** /**
* {@inheritdoc} * {@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, 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, ModuleHandlerInterface $moduleHandler) {
parent::__construct($configuration, $plugin_id, $plugin_definition); parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->serializer = $serializer; $this->serializer = $serializer;
@ -144,7 +113,6 @@ class IIIFManifest extends StylePluginBase {
$this->fileSystem = $file_system; $this->fileSystem = $file_system;
$this->httpClient = $http_client; $this->httpClient = $http_client;
$this->messenger = $messenger; $this->messenger = $messenger;
$this->utils = $utils;
$this->moduleHandler = $moduleHandler; $this->moduleHandler = $moduleHandler;
} }
@ -163,8 +131,7 @@ class IIIFManifest extends StylePluginBase {
$container->get('file_system'), $container->get('file_system'),
$container->get('http_client'), $container->get('http_client'),
$container->get('messenger'), $container->get('messenger'),
$container->get('module_handler'), $container->get('module_handler')
$container->get('islandora.utils')
); );
} }
@ -192,33 +159,15 @@ class IIIFManifest extends StylePluginBase {
// @todo assumming the view is a path like /node/1/manifest.json // @todo assumming the view is a path like /node/1/manifest.json
$url_components = explode('/', trim($request_url, '/')); $url_components = explode('/', trim($request_url, '/'));
array_pop($url_components); array_pop($url_components);
$content_path = '/' . implode('/', $url_components); $content_path = implode('/', $url_components);
$iiif_base_id = "{$request_host}{$content_path}"; $iiif_base_id = $request_host . '/' . $content_path;
$display = $this->iiifConfig->get('show_title');
switch ($display) {
case 'none':
$label = '';
break;
case 'view':
$label = $this->view->getTitle();
break;
case 'node':
$label = $this->getEntityTitle($content_path);
break;
default:
$label = $this->t("IIIF Manifest");
}
// @see https://iiif.io/api/presentation/2.1/#manifest // @see https://iiif.io/api/presentation/2.1/#manifest
$json += [ $json += [
'@type' => 'sc:Manifest', '@type' => 'sc:Manifest',
'@id' => $request_url, '@id' => $request_url,
// If the View has a title, set the View title as the manifest label. // If the View has a title, set the View title as the manifest label.
'label' => $label, 'label' => $this->view->getTitle() ?: $this->getEntityTitle($content_path),
'@context' => 'http://iiif.io/api/presentation/2/context.json', '@context' => 'http://iiif.io/api/presentation/2/context.json',
// @see https://iiif.io/api/presentation/2.1/#sequence // @see https://iiif.io/api/presentation/2.1/#sequence
'sequences' => [ 'sequences' => [
@ -242,9 +191,6 @@ class IIIFManifest extends StylePluginBase {
$content_type = 'json'; $content_type = 'json';
// Add a search endpoint if one is defined.
$this->addSearchEndpoint($json, $url_components);
// Give other modules a chance to alter the manifest. // Give other modules a chance to alter the manifest.
$this->moduleHandler->alter('islandora_iiif_manifest', $json, $this); $this->moduleHandler->alter('islandora_iiif_manifest', $json, $this);
@ -282,13 +228,7 @@ class IIIFManifest extends StylePluginBase {
// Create the IIIF URL for this file // Create the IIIF URL for this file
// Visiting $iiif_url will resolve to the info.json for the image. // Visiting $iiif_url will resolve to the info.json for the image.
if ($this->iiifConfig->get('use_relative_paths')) { $file_url = $image->entity->createFileUrl(FALSE);
$file_url = ltrim($image->entity->createFileUrl(TRUE), '/');
}
else {
$file_url = $image->entity->createFileUrl(FALSE);
}
$mime_type = $image->entity->getMimeType(); $mime_type = $image->entity->getMimeType();
$iiif_url = rtrim($iiif_address, '/') . '/' . urlencode($file_url); $iiif_url = rtrim($iiif_address, '/') . '/' . urlencode($file_url);
@ -328,7 +268,7 @@ class IIIFManifest extends StylePluginBase {
], ],
]; ];
if ($ocr_url = $this->getOcrUrl($entity)) { if ($ocr_url = $this->getOcrUrl($entity, $row, $i)) {
$tmp_canvas['seeAlso'] = [ $tmp_canvas['seeAlso'] = [
'@id' => $ocr_url, '@id' => $ocr_url,
'format' => 'text/vnd.hocr+html', 'format' => 'text/vnd.hocr+html',
@ -366,12 +306,6 @@ class IIIFManifest extends StylePluginBase {
* The width and height of the image. * The width and height of the image.
*/ */
protected function getCanvasDimensions(string $iiif_url, FieldItemInterface $image, string $mime_type) { protected function getCanvasDimensions(string $iiif_url, FieldItemInterface $image, string $mime_type) {
if (isset($image->width) && is_numeric($image->width)
&& isset($image->height) && is_numeric($image->height)) {
return [intval($image->width), intval($image->height)];
}
try { try {
$info_json = $this->httpClient->get($iiif_url)->getBody(); $info_json = $this->httpClient->get($iiif_url)->getBody();
$resource = json_decode($info_json, TRUE); $resource = json_decode($info_json, TRUE);
@ -389,7 +323,7 @@ class IIIFManifest extends StylePluginBase {
// If this is a TIFF AND we don't know the width/height // 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. // see if we can get the image size via PHP's core function.
if ($mime_type === 'image/tiff' && (!$width || !$height)) { if ($mime_type === 'image/tiff' && !$width || !$height) {
$uri = $image->entity->getFileUri(); $uri = $image->entity->getFileUri();
$path = $this->fileSystem->realpath($uri); $path = $this->fileSystem->realpath($uri);
$image_size = getimagesize($path); $image_size = getimagesize($path);
@ -408,38 +342,30 @@ class IIIFManifest extends StylePluginBase {
* *
* @param \Drupal\Core\Entity\EntityInterface $entity * @param \Drupal\Core\Entity\EntityInterface $entity
* The entity at the current row. * The entity at the current row.
* @param \Drupal\views\ResultRow $row
* Result 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, * The absolute URL of the current row's structured text,
* or FALSE if none. * or FALSE if none.
*/ */
protected function getOcrUrl(EntityInterface $entity) { protected function getOcrUrl(EntityInterface $entity, ResultRow $row, $delta) {
$ocr_url = FALSE; $ocr_url = FALSE;
$iiif_ocr_file_field = !empty($this->options['iiif_ocr_file_field']) ? array_filter(array_values($this->options['iiif_ocr_file_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; $ocrField = count($iiif_ocr_file_field) > 0 ? $this->view->field[$iiif_ocr_file_field[0]] : NULL;
if ($ocrField) { if ($ocrField) {
$ocr_entity = $entity; $ocr_entity = $ocrField->getEntity($row);
$ocr_field_name = $ocrField->definition['field_name']; $ocr_field_name = $ocrField->definition['field_name'];
if (!is_null($ocr_field_name)) { if (!is_null($ocr_field_name)) {
$ocrs = $ocr_entity->{$ocr_field_name}; $ocrs = $ocr_entity->{$ocr_field_name};
$ocr = $ocrs[0] ?? FALSE; $ocr = isset($ocrs[$delta]) ? $ocrs[$delta] : FALSE;
if ($ocr) { if ($ocr) {
$ocr_url = $ocr->entity->createFileUrl(FALSE); $ocr_url = $ocr->entity->createFileUrl(FALSE);
} }
} }
} }
elseif ($structured_text_term = $this->getStructuredTextTerm()) {
$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; return $ocr_url;
} }
@ -484,29 +410,6 @@ class IIIFManifest extends StylePluginBase {
return $options; return $options;
} }
/**
* Add the configured search endpoint to the manifest.
*
* @param array $json
* The IIIF manifest.
* @param array $url_components
* The search endpoint URL as array.
*/
protected function addSearchEndpoint(array &$json, array $url_components) {
$url_base = $this->getRequest()->getSchemeAndHttpHost();
$hocr_search_path = $this->options['search_endpoint'];
$hocr_search_url = $url_base . '/' . ltrim($hocr_search_path, '/');
$hocr_search_url = str_replace('%node', $url_components[1], $hocr_search_url);
$json['service'][] = [
"@context" => "http://iiif.io/api/search/0/context.json",
"@id" => $hocr_search_url,
"profile" => "http://iiif.io/api/search/0/search",
"label" => t("Search inside this work"),
];
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -563,27 +466,10 @@ class IIIFManifest extends StylePluginBase {
'#title' => $this->t('Structured OCR data file field'), '#title' => $this->t('Structured OCR data file field'),
'#type' => 'checkboxes', '#type' => 'checkboxes',
'#default_value' => $this->options['iiif_ocr_file_field'], '#default_value' => $this->options['iiif_ocr_file_field'],
'#description' => $this->t("If the hOCR is a field on the same entity as the image source field above, select it here. If it's found in a related entity via the term below, leave this blank."), '#description' => $this->t('The source of structured OCR text for each entity.'),
'#options' => $field_options, '#options' => $field_options,
'#required' => FALSE, '#required' => FALSE,
]; ];
$form['structured_text_term'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'taxonomy_term',
'#title' => $this->t('Structured OCR text term'),
'#default_value' => $this->getStructuredTextTerm(),
'#required' => FALSE,
'#description' => $this->t('Term indicating the media that holds structured text, such as hOCR, for the given object. Use this if the text is on a separate media from the tile source.'),
];
$form['search_endpoint'] = [
'#type' => 'textfield',
'#title' => $this->t("Search endpoint path."),
'#description' => $this->t("If there is a search endpoint to search within the book that returns IIIF annotations, put it here. Use %node substitution where needed.<br>E.g., paged-content-search/%node"),
'#default_value' => $this->options['search_endpoint'],
'#required' => FALSE,
];
} }
/** /**
@ -596,41 +482,4 @@ class IIIFManifest extends StylePluginBase {
return ['json' => 'json']; 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.
*/
// @codingStandardsIgnoreStart
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
// @codingStandardsIgnoreEnd
$style_options = $form_state->getValue('style_options');
$tid = $style_options['structured_text_term'];
unset($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);
}
/**
* Get the structured text term.
*
* @return \Drupal\taxonomy\TermInterface|null
* The term if it could be found; otherwise, NULL.
*/
protected function getStructuredTextTerm() : ?TermInterface {
if (!$this->structuredTextTermMemoized) {
$this->structuredTextTermMemoized = TRUE;
$this->structuredTextTerm = $this->utils->getTermForUri($this->options['structured_text_term_uri']);
}
return $this->structuredTextTerm;
}
} }

3
modules/islandora_image/islandora_image.info.yml

@ -1,7 +1,8 @@
name: 'Islandora Image' name: 'Islandora Image'
type: module type: module
description: 'Islandora Image derivative actions' description: 'Islandora Image derivative actions'
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
package: Islandora package: Islandora
dependencies: dependencies:
- drupal:islandora - drupal:islandora

6
modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php

@ -42,7 +42,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
// Create an action to generate a jpeg thumbnail. // Create an action to generate a jpeg thumbnail.
$this->drupalGet('admin/config/system/actions'); $this->drupalGet('admin/config/system/actions');
$this->getSession()->getPage()->findById("edit-action")->selectOption("Generate an image derivative"); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate an image derivative");
$this->getSession()->getPage()->pressButton('Create'); $this->getSession()->getPage()->pressButton($this->t('Create'));
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
$this->getSession()->getPage()->fillField('edit-label', "Generate image test derivative"); $this->getSession()->getPage()->fillField('edit-label', "Generate image test derivative");
@ -55,7 +55,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
$this->getSession()->getPage()->fillField('edit-args', "-thumbnail 20x20"); $this->getSession()->getPage()->fillField('edit-args', "-thumbnail 20x20");
$this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-scheme', "public");
$this->getSession()->getPage()->fillField('edit-path', "derp.jpeg"); $this->getSession()->getPage()->fillField('edit-path', "derp.jpeg");
$this->getSession()->getPage()->pressButton('Save'); $this->getSession()->getPage()->pressButton($this->t('Save'));
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Create a context and add the action as a derivative reaction. // Create a context and add the action as a derivative reaction.
@ -71,7 +71,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
]; ];
$this->drupalGet('media/add/' . $this->testMediaType->id()); $this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, 'Save'); $this->submitForm($values, $this->t('Save'));
$expected = [ $expected = [
'source_uri' => 'test_file.txt', 'source_uri' => 'test_file.txt',

3
modules/islandora_text_extraction/islandora_text_extraction.info.yml

@ -1,7 +1,8 @@
name: 'Islandora Text Extraction' name: 'Islandora Text Extraction'
type: module type: module
description: 'Islandora 8 module to connect to Hypercube microservice, and to get text from PDF ingest' description: 'Islandora 8 module to connect to Hypercube microservice, and to get text from PDF ingest'
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
package: 'Islandora' package: 'Islandora'
dependencies: dependencies:
- drupal:islandora - drupal:islandora

5
modules/islandora_text_extraction/src/Plugin/Action/GenerateOCRDerivative.php

@ -48,9 +48,8 @@ class GenerateOCRDerivative extends AbstractGenerateDerivative {
*/ */
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::validateConfigurationForm($form, $form_state); parent::validateConfigurationForm($form, $form_state);
$mime = $form_state->getValue('mimetype'); $exploded_mime = explode('/', $form_state->getValue('mimetype'));
$exploded_mime = explode('/', $mime); if ($exploded_mime[0] != 'text') {
if ($exploded_mime[0] != 'text' && $mime != 'application/xml') {
$form_state->setErrorByName( $form_state->setErrorByName(
'mimetype', 'mimetype',
$this->t('Please enter file mimetype (e.g. text/plain.)') $this->t('Please enter file mimetype (e.g. text/plain.)')

5
modules/islandora_text_extraction/src/Plugin/Field/FieldFormatter/OcrTextFormatter.php

@ -132,9 +132,8 @@ class OcrTextFormatter extends FormatterBase implements ContainerFactoryPluginIn
$fileItem = $item->getValue(); $fileItem = $item->getValue();
$file = $this->entityTypeManager->getStorage('file')->load($fileItem['target_id']); $file = $this->entityTypeManager->getStorage('file')->load($fileItem['target_id']);
$contents = file_get_contents($file->getFileUri()); $contents = file_get_contents($file->getFileUri());
$detected_encoding = mb_detect_encoding($contents); if (mb_detect_encoding($contents) != 'UTF-8') {
if ($detected_encoding != 'UTF-8') { $contents = utf8_encode($contents);
$contents = mb_convert_encoding($contents, 'UTF-8', $detected_encoding);
} }
$contents = nl2br($contents); $contents = nl2br($contents);
return $contents; return $contents;

0
modules/islandora_text_extraction_defaults/config/optional/core.entity_form_display.media.extracted_text.default.yml → modules/islandora_text_extraction_defaults/config/install/core.entity_form_display.media.extracted_text.default.yml

0
modules/islandora_text_extraction_defaults/config/optional/core.entity_view_display.media.extracted_text.default.yml → modules/islandora_text_extraction_defaults/config/install/core.entity_view_display.media.extracted_text.default.yml

0
modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_edited_text.yml → modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_edited_text.yml

0
modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_file.yml → modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_file.yml

0
modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_of.yml → modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_of.yml

0
modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_use.yml → modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_use.yml

0
modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_mime_type.yml → modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_mime_type.yml

0
modules/islandora_text_extraction_defaults/config/optional/field.storage.media.field_edited_text.yml → modules/islandora_text_extraction_defaults/config/install/field.storage.media.field_edited_text.yml

0
modules/islandora_text_extraction_defaults/config/optional/language.content_settings.media.extracted_text.yml → modules/islandora_text_extraction_defaults/config/install/language.content_settings.media.extracted_text.yml

0
modules/islandora_text_extraction_defaults/config/optional/media.type.extracted_text.yml → modules/islandora_text_extraction_defaults/config/install/media.type.extracted_text.yml

0
modules/islandora_text_extraction_defaults/config/optional/rdf.mapping.media.extracted_text.yml → modules/islandora_text_extraction_defaults/config/install/rdf.mapping.media.extracted_text.yml

0
modules/islandora_text_extraction_defaults/config/optional/system.action.get_ocr_from_image.yml → modules/islandora_text_extraction_defaults/config/install/system.action.get_ocr_from_image.yml

2
modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.features.yml

@ -0,0 +1,2 @@
bundle: islandora
required: true

3
modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.info.yml

@ -1,7 +1,8 @@
name: 'Islandora Text Extraction Defaults' name: 'Islandora Text Extraction Defaults'
type: module type: module
description: 'Default config for the Islandora Text Extraction module.' description: 'Default config for the Islandora Text Extraction module.'
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
package: Islandora package: Islandora
dependencies: dependencies:
- drupal:field - drupal:field

3
modules/islandora_video/islandora_video.info.yml

@ -2,6 +2,7 @@ name: 'Islandora Video'
description: 'Islandora video derivative actions' description: 'Islandora video derivative actions'
type: module type: module
package: Islandora package: Islandora
core_version_requirement: ^9 || ^10 core: 8.x
core_version_requirement: ^8 || ^9
dependencies: dependencies:
- drupal:islandora - drupal:islandora

6
modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php

@ -37,7 +37,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
// Create an action to generate a jpeg thumbnail. // Create an action to generate a jpeg thumbnail.
$this->drupalGet('admin/config/system/actions'); $this->drupalGet('admin/config/system/actions');
$this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a video derivative"); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a video derivative");
$this->getSession()->getPage()->pressButton('Create'); $this->getSession()->getPage()->pressButton($this->t('Create'));
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
$this->getSession()->getPage()->fillField('edit-label', "Generate video test derivative"); $this->getSession()->getPage()->fillField('edit-label', "Generate video test derivative");
@ -50,7 +50,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
$this->getSession()->getPage()->fillField('edit-args', "-f mp4"); $this->getSession()->getPage()->fillField('edit-args', "-f mp4");
$this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-scheme', "public");
$this->getSession()->getPage()->fillField('edit-path', "derp.mov"); $this->getSession()->getPage()->fillField('edit-path', "derp.mov");
$this->getSession()->getPage()->pressButton('Save'); $this->getSession()->getPage()->pressButton($this->t('Save'));
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Create a context and add the action as a derivative reaction. // Create a context and add the action as a derivative reaction.
@ -66,7 +66,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(),
]; ];
$this->drupalGet('media/add/' . $this->testMediaType->id()); $this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, 'Save'); $this->submitForm($values, $this->t('Save'));
$expected = [ $expected = [
'source_uri' => 'test_file.txt', 'source_uri' => 'test_file.txt',

2
phpunit.xml

@ -47,7 +47,7 @@
<!-- Example for changing the driver args to phantomjs tests MINK_DRIVER_ARGS_PHANTOMJS value: '["http://127.0.0.1:8510"]' --> <!-- Example for changing the driver args to phantomjs tests MINK_DRIVER_ARGS_PHANTOMJS value: '["http://127.0.0.1:8510"]' -->
<env name="MINK_DRIVER_ARGS_PHANTOMJS" value=""/> <env name="MINK_DRIVER_ARGS_PHANTOMJS" value=""/>
<!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" --> <!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" -->
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://localhost:9515"]'/> <env name="MINK_DRIVER_ARGS_WEBDRIVER" value=""/>
</php> </php>
<testsuites> <testsuites>
<testsuite name="unit"> <testsuite name="unit">

2
src/Controller/ManageMembersController.php

@ -29,7 +29,7 @@ class ManageMembersController extends EntityController {
* *
* @var \Drupal\Core\Entity\EntityFieldManagerInterface * @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/ */
protected $entityFieldManager; protected $entityFieldManger;
/** /**
* The renderer. * The renderer.

16
src/EventGenerator/EventGenerator.php

@ -147,19 +147,8 @@ class EventGenerator implements EventGeneratorInterface {
} }
} }
$allowed_keys = [ unset($data["event"]);
"file_upload_uri", unset($data["queue"]);
"fedora_uri",
"source_uri",
"destination_uri",
"args",
"mimetype",
"source_field",
];
$keys_to_unset = array_diff(array_keys($data), $allowed_keys);
foreach ($keys_to_unset as $key) {
unset($data[$key]);
}
if (!empty($data)) { if (!empty($data)) {
$event["attachment"] = [ $event["attachment"] = [
@ -203,7 +192,6 @@ class EventGenerator implements EventGeneratorInterface {
protected function getRevisionIds(Media $media, EntityStorageInterface $media_storage) { protected function getRevisionIds(Media $media, EntityStorageInterface $media_storage) {
$result = $media_storage->getQuery() $result = $media_storage->getQuery()
->allRevisions() ->allRevisions()
->accessCheck(TRUE)
->condition($media->getEntityType()->getKey('id'), $media->id()) ->condition($media->getEntityType()->getKey('id'), $media->id())
->sort($media->getEntityType()->getKey('revision'), 'DESC') ->sort($media->getEntityType()->getKey('revision'), 'DESC')
->execute(); ->execute();

20
src/Flysystem/Adapter/FedoraAdapter.php

@ -3,6 +3,7 @@
namespace Drupal\islandora\Flysystem\Adapter; namespace Drupal\islandora\Flysystem\Adapter;
use GuzzleHttp\Psr7\Header; use GuzzleHttp\Psr7\Header;
use function GuzzleHttp\Psr7\parse_header;
use Drupal\Core\Logger\LoggerChannelInterface; use Drupal\Core\Logger\LoggerChannelInterface;
use Islandora\Chullo\IFedoraApi; use Islandora\Chullo\IFedoraApi;
use League\Flysystem\AdapterInterface; use League\Flysystem\AdapterInterface;
@ -159,8 +160,14 @@ class FedoraAdapter implements AdapterInterface {
// NonRDFSource's are considered files. Everything else is a // NonRDFSource's are considered files. Everything else is a
// directory. // directory.
$type = 'dir'; $type = 'dir';
$links = Header::parse($response->getHeader('Link')); // phpcs:disable
if (class_exists(Header::class)) {
$links = Header::parse($response->getHeader('Link'));
}
else {
$links = parse_header($response->getHeader('Link'));
}
// phpcs:enable
foreach ($links as $link) { foreach ($links as $link) {
if ($link['rel'] == 'type' && $link[0] == '<http://www.w3.org/ns/ldp#NonRDFSource>') { if ($link['rel'] == 'type' && $link[0] == '<http://www.w3.org/ns/ldp#NonRDFSource>') {
$type = 'file'; $type = 'file';
@ -396,7 +403,14 @@ class FedoraAdapter implements AdapterInterface {
$return = NULL; $return = NULL;
if ($response->getStatusCode() == 410) { if ($response->getStatusCode() == 410) {
$return = FALSE; $return = FALSE;
$link_headers = Header::parse($response->getHeader('Link')); // phpcs:disable
if (class_exists(Header::class)) {
$link_headers = Header::parse($response->getHeader('Link'));
}
else {
$link_headers = parse_header($response->getHeader('Link'));
}
// phpcs:enable
if ($link_headers) { if ($link_headers) {
$tombstones = array_filter($link_headers, function ($o) { $tombstones = array_filter($link_headers, function ($o) {
return (isset($o['rel']) && $o['rel'] == 'hasTombstone'); return (isset($o['rel']) && $o['rel'] == 'hasTombstone');

10
src/Form/ConfirmDeleteMediaAndFile.php

@ -128,9 +128,6 @@ class ConfirmDeleteMediaAndFile extends DeleteMultipleForm {
// Check for files. // Check for files.
$fields = $this->entityFieldManager->getFieldDefinitions('media', $entity->bundle()); $fields = $this->entityFieldManager->getFieldDefinitions('media', $entity->bundle());
foreach ($fields as $field) { foreach ($fields as $field) {
if ($field->getName() == 'thumbnail') {
continue;
}
$type = $field->getType(); $type = $field->getType();
if ($type == 'file' || $type == 'image') { if ($type == 'file' || $type == 'image') {
$target_id = $entity->get($field->getName())->target_id; $target_id = $entity->get($field->getName())->target_id;
@ -140,11 +137,8 @@ class ConfirmDeleteMediaAndFile extends DeleteMultipleForm {
$inaccessible_entities[] = $file; $inaccessible_entities[] = $file;
continue; continue;
} }
if (!array_key_exists($file->id(), $delete_files)) { $delete_files[$file->id()] = $file;
$delete_files[$file->id()] = $file; $total_count++;
$total_count++;
}
} }
} }
} }

25
src/Form/IslandoraSettingsForm.php

@ -43,7 +43,6 @@ class IslandoraSettingsForm extends ConfigFormBase {
]; ];
const GEMINI_PSEUDO_FIELD = 'field_gemini_uri'; const GEMINI_PSEUDO_FIELD = 'field_gemini_uri';
const NODE_DELETE_MEDIA_AND_FILES = 'delete_media_and_files'; const NODE_DELETE_MEDIA_AND_FILES = 'delete_media_and_files';
const REDIRECT_AFTER_MEDIA_SAVE = 'redirect_after_media_save';
/** /**
* To list the available bundle types. * To list the available bundle types.
@ -129,9 +128,6 @@ class IslandoraSettingsForm extends ConfigFormBase {
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('URL'), '#title' => $this->t('URL'),
'#default_value' => $config->get(self::BROKER_URL), '#default_value' => $config->get(self::BROKER_URL),
'#config' => [
'key' => 'islandora.settings:' . self::BROKER_URL,
],
]; ];
$broker_user = $config->get(self::BROKER_USER); $broker_user = $config->get(self::BROKER_USER);
$form['broker_info']['provide_user_creds'] = [ $form['broker_info']['provide_user_creds'] = [
@ -152,9 +148,6 @@ class IslandoraSettingsForm extends ConfigFormBase {
$state_selector => ['checked' => TRUE], $state_selector => ['checked' => TRUE],
], ],
], ],
'#config' => [
'key' => 'islandora.settings:' . self::BROKER_USER,
],
]; ];
$form['broker_info'][self::BROKER_PASSWORD] = [ $form['broker_info'][self::BROKER_PASSWORD] = [
'#type' => 'password', '#type' => 'password',
@ -165,10 +158,6 @@ class IslandoraSettingsForm extends ConfigFormBase {
$state_selector => ['checked' => TRUE], $state_selector => ['checked' => TRUE],
], ],
], ],
'#config' => [
'key' => 'islandora.settings:' . self::BROKER_PASSWORD,
'secret' => TRUE,
],
]; ];
$form[self::JWT_EXPIRY] = [ $form[self::JWT_EXPIRY] = [
'#type' => 'textfield', '#type' => 'textfield',
@ -221,21 +210,10 @@ class IslandoraSettingsForm extends ConfigFormBase {
'#default_value' => (bool) $config->get(self::NODE_DELETE_MEDIA_AND_FILES), '#default_value' => (bool) $config->get(self::NODE_DELETE_MEDIA_AND_FILES),
]; ];
$form[self::REDIRECT_AFTER_MEDIA_SAVE] = [
'#type' => 'checkbox',
'#title' => $this->t('Redirect after media save.'),
'#description' => $this->t('Redirect to node-specific media list after creation of media.'),
'#default_value' => (bool) $config->get(self::REDIRECT_AFTER_MEDIA_SAVE),
];
$form[self::FEDORA_URL] = [ $form[self::FEDORA_URL] = [
'#type' => 'textfield', '#type' => 'textfield',
'#title' => $this->t('Fedora URL'), '#title' => $this->t('Fedora URL'),
'#description' => $this->t('Read-only. This value is set in settings.php as the URL for the Fedora flysystem.'), '#attributes' => ['readonly' => 'readonly'],
'#attributes' => [
'readonly' => 'readonly',
'disabled' => 'disabled',
],
'#default_value' => $fedora_url, '#default_value' => $fedora_url,
]; ];
@ -383,7 +361,6 @@ class IslandoraSettingsForm extends ConfigFormBase {
->set(self::UPLOAD_FORM_ALLOWED_MIMETYPES, $form_state->getValue(self::UPLOAD_FORM_ALLOWED_MIMETYPES)) ->set(self::UPLOAD_FORM_ALLOWED_MIMETYPES, $form_state->getValue(self::UPLOAD_FORM_ALLOWED_MIMETYPES))
->set(self::GEMINI_PSEUDO, $new_pseudo_types) ->set(self::GEMINI_PSEUDO, $new_pseudo_types)
->set(self::NODE_DELETE_MEDIA_AND_FILES, $form_state->getValue(self::NODE_DELETE_MEDIA_AND_FILES)) ->set(self::NODE_DELETE_MEDIA_AND_FILES, $form_state->getValue(self::NODE_DELETE_MEDIA_AND_FILES))
->set(self::REDIRECT_AFTER_MEDIA_SAVE, $form_state->getValue(self::REDIRECT_AFTER_MEDIA_SAVE))
->save(); ->save();
parent::submitForm($form, $form_state); parent::submitForm($form, $form_state);

2
src/IslandoraContextManager.php

@ -37,7 +37,7 @@ class IslandoraContextManager extends ContextManager {
} }
/** @var \Drupal\context\ContextInterface $context */ /** @var \Drupal\context\ContextInterface $context */
foreach ($this->getContexts() as $context) { foreach ($this->getContexts() as $context) {
if (!$context->disabled() && $this->evaluateContextConditions($context, $provided)) { if ($this->evaluateContextConditions($context, $provided) && !$context->disabled()) {
$this->activeContexts[$context->id()] = $context; $this->activeContexts[$context->id()] = $context;
} }
} }

6
src/Plugin/Condition/NodeHasParent.php

@ -137,11 +137,9 @@ class NodeHasParent extends ConditionPluginBase implements ContainerFactoryPlugi
* TRUE if entity references the specified parent. * TRUE if entity references the specified parent.
*/ */
protected function evaluateEntity(EntityInterface $entity) { protected function evaluateEntity(EntityInterface $entity) {
$parent_reference_field = $this->configuration['parent_reference_field'];
foreach ($entity->referencedEntities() as $referenced_entity) { foreach ($entity->referencedEntities() as $referenced_entity) {
// Check whether the entity and the referenced entity are nodes. if ($entity->getEntityTypeID() == 'node' && $referenced_entity->getEntityTypeId() == 'node') {
// Also make sure that the field exists. $parent_reference_field = $this->configuration['parent_reference_field'];
if ($entity->getEntityTypeID() == 'node' && $entity->hasField($parent_reference_field) && $referenced_entity->getEntityTypeId() == 'node') {
$field = $entity->get($parent_reference_field); $field = $entity->get($parent_reference_field);
if (!$field->isEmpty()) { if (!$field->isEmpty()) {
$nids = $field->getValue(); $nids = $field->getValue();

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save