Skip to content

Commit

Permalink
Merge pull request #62 from discoverygarden/fix/title-changes
Browse files Browse the repository at this point in the history
BCELN24MIG-224: Prioritize untyped titleInfo for Drupal title; fallback to label.
  • Loading branch information
nchiasson-dgi authored Jan 21, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 057a699 + dadf5b7 commit 9e16e92
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Plugin/dgi_migrate_alter/foxml/DgisNodesAlter.php
Original file line number Diff line number Diff line change
@@ -193,6 +193,31 @@ public function alter(array &$migration) {

unset($process['field_note'][5]);

// Title paragraphs should only be generated for things with a "type".
$process['field_title'][0]['query'] = 'mods:titleInfo[@type][normalize-space(mods:nonSort | mods:title | mods:subTitle | mods:partNumber | mods:partName)]';

// Custom title processing logic. Use the defined XPath if it exists.
$fedora_label = $process['title'];
unset($process['title']);

$mods_title_info = $process['field_description'];
$mods_title_info[0]['query'] = 'mods:titleInfo/mods:title[not(@type)][normalize-space()][1]';
$process['_mods_title_info'] = $mods_title_info;
$process['_fedora_label'] = $fedora_label;
$process['title'] = [
[
'plugin' => 'null_coalesce',
'source' => [
'@_mods_title_info',
'@_fedora_label',
],
],
[
'plugin' => 'default_value',
'default_value' => 'Untitled',
],
];

$to_remove = [
['field_version_identifier'],
['field_resource_publication_statu'],

0 comments on commit 9e16e92

Please # to comment.