initial checkin for ArchivesSapce EAD migration module#1
initial checkin for ArchivesSapce EAD migration module#1
Conversation
|
This is the initial check-in for a custom module to migrating ArchivesSpace EAD into drupal media entities |
ctgraham
left a comment
There was a problem hiding this comment.
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'])) { |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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.' | |||
| * @var array | ||
| */ | ||
| protected $connectionInfo = [ | ||
| 'base_uri' => 'https://pittapi.as.atlas-sys.com', |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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).
No description provided.