Skip to content

Commit

Permalink
Merge pull request #37 from discoverygarden/revert-36-revert-31-DDST-521
Browse files Browse the repository at this point in the history
Revert "Revert "DDST-521: Add status checking with POLICY.""
  • Loading branch information
nchiasson-dgi authored Sep 20, 2024
2 parents 18b9c16 + 14bc473 commit 0f41c5e
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/Plugin/dgi_migrate_alter/foxml/DgisNodesAlter.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public function alter(array &$migration) {
'default_value' => NULL,
];

$this->processStatusCheck($process);

$process['field_description'][0]['query'] = 'mods:abstract[not(@displayLabel)]';

$process['field_local_contexts'] = $process['field_ismn'];
Expand Down Expand Up @@ -345,4 +347,53 @@ private function processOrganizationValues(array &$values): void {
];
}

/**
* Changes how the status is set based upon defined conditions.
*/
private function processStatusCheck(array &$process): void {
// The default status behavior is retained as a fallback.
$process['_status'] = $process['status'];
$process['_policy_status'] = [
[
'plugin' => 'dgi_migrate.subindex',
'source' => '@_node_foxml_parsed',
'index' => 'POLICY',
'missing_behaviour' => 'skip_process',
],
[
'plugin' => 'dgi_migrate.subproperty',
'source' => '@_node_foxml_parsed',
'property' => 'PID',
],
[
'plugin' => 'explode',
'delimiter' => ':',
],
[
'plugin' => 'extract',
'index' => [0],
],
[
'plugin' => 'static_map',
'map' => [
'cmtn' => 0,
'nwcc' => 0,
'cotr' => 0,
],
'default_value' => NULL,
],
];
// XXX: Unset so it gets re-keyed after the internal fields are made.
unset($process['status']);
$process['status'] = [
[
'plugin' => 'null_coalesce',
'source' => [
'@_policy_status',
'@_status',
],
],
];
}

}

0 comments on commit 0f41c5e

Please sign in to comment.