Skip to content

initial checkin for ArchivesSapce EAD migration module#1

Open
rzhang152 wants to merge 3 commits intomainfrom
feature/migration_source
Open

initial checkin for ArchivesSapce EAD migration module#1
rzhang152 wants to merge 3 commits intomainfrom
feature/migration_source

Conversation

@rzhang152
Copy link
Copy Markdown
Collaborator

No description provided.

@rzhang152
Copy link
Copy Markdown
Collaborator Author

This is the initial check-in for a custom module to migrating ArchivesSpace EAD into drupal media entities

@rzhang152 rzhang152 self-assigned this Apr 8, 2026
Copy link
Copy Markdown
Member

@ctgraham ctgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. I have some changes to avoid hardcoding the path.

public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);

if (isset($configuration['constants']['aspace_ead_dir'])) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than use a directory as the parameter, use the media bundle as the parameter and read the configured directory.

Something like:

    // Fetch the media type bundle from the config
    if (isset($configuration['constants']['media_bundle'])) {
      // Load the field config for field_media_file on your media bundle
      $field_config = \Drupal::entityTypeManager()
        ->getStorage('field_config')
        ->load('media.findingaid.field_media_file');

      $file_directory = $field_config->getSetting('file_directory');

      // Resolve tokens — pass a context entity if tokens depend on the entity
      $token = \Drupal::token();
      $resolved = $token->replace($file_directory, [], ['clear' => TRUE]);

      $scheme = $field_config->getSetting('uri_scheme') ?? 'public';

      $this->eadXmlDir = $scheme . '://' . trim($resolved, '/') . '/' . $value;
    } else {
      $this->eadXmlDir = self::SAVE_BASE_URI;
    }

plugin: aspace_file_source
object_type: resources
constants:
aspace_ead_dir: 'private://findingaid'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than code the directory here, let's use the Media bundle as the setting, and fetch the directory from there:

Something like

  constants:
    media_bundle: 'findingaid'

This constant should also be used in the destination.

Then, see ASpaceFileSource.

@@ -0,0 +1,5 @@
id: aspace_ead_migration
label: 'ASpace EAD Migration'
description: 'Migrations EAD files from ArchivesSpace API into Drupal managed media entities.'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Migrates EAD files..."

* @var array
*/
protected $connectionInfo = [
'base_uri' => 'https://pittapi.as.atlas-sys.com',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a dummy value in here, if a value is even needed at all. We don't need folks trying admin:admin against our site, even if it won't work.


This module is designed to migrate ArchivesSpace EAD into drupal media entities.

## Installation and Configuration
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a Prerequisites section. This probably includes Islandora? And certainly includes the Media Entity bundle we've hardcoded above (and the fields we hardcode from it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants