Skip to content

Commit

Permalink
Prioritize untyped titleInfo for Drupal title; fallback to label.
Browse files Browse the repository at this point in the history
  • Loading branch information
jordandukart committed Jan 17, 2025
1 parent 209779c commit dadf5b7
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
Expand Up @@ -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'],
Expand Down

0 comments on commit dadf5b7

Please # to comment.