Skip to content

Commit 2a17685

Browse files
committed
Adding OaiMetadataMap & DssiNodeAlter
1 parent d1b0696 commit 2a17685

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
namespace Drupal\pcdora\Plugin\OaiMetadataMap;
4+
5+
use Drupal\dgi_standard_oai\Plugin\OaiMetadataMap\DgiStandard;
6+
7+
/**
8+
* OAI Dublin Core mapping for PC.
9+
*
10+
* @OaiMetadataMap(
11+
* id = "pc_dublin_core",
12+
* label = @Translation("OAI Dublin Core (PC)"),
13+
* metadata_format = "oai_dc",
14+
* template = {
15+
* "type" = "module",
16+
* "name" = "rest_oai_pmh",
17+
* "directory" = "templates",
18+
* "file" = "oai-default"
19+
* }
20+
* )
21+
*/
22+
class DublinCore extends DgiStandard {
23+
24+
25+
/**
26+
* Mapping of paragraph fields to maps of subfields to element names.
27+
*
28+
* @var string[][]
29+
*/
30+
protected const PARAGRAPH_MAPPING = [
31+
'field_faceted_subject' => [
32+
'field_topic_general_subdivision_' => 'dcterms:subject',
33+
'field_temporal_chronological_sub' => 'dcterms:temporal',
34+
'field_geographic_geographic_subd' => 'dcterms:spatial',
35+
],
36+
'field_hierarchical_geographic_su' => [
37+
'field_continent' => 'dcterms:spatial',
38+
'field_country' => 'dcterms:spatial',
39+
'field_region' => 'dcterms:spatial',
40+
'field_state' => 'dcterms:spatial',
41+
'field_territory' => 'dcterms:spatial',
42+
'field_county' => 'dcterms:spatial',
43+
'field_city' => 'dcterms:spatial',
44+
'field_city_section' => 'dcterms:spatial',
45+
'field_island' => 'dcterms:spatial',
46+
'field_area' => 'dcterms:spatial',
47+
'field_extraterrestrial_area' => 'dcterms:spatial',
48+
],
49+
'field_origin_information' => [
50+
'field_date_created' => 'dcterms:created',
51+
'field_date_issued' => 'dcterms:issued',
52+
'field_date_note' => 'dcterms:date',
53+
'field_date_captured' => 'dcterms:date',
54+
'field_date_valid' => 'dcterms:date',
55+
'field_date_modified' => 'dcterms:date',
56+
'field_copyright_date' => 'dcterms:date',
57+
'field_publisher' => 'dcterms:publisher',
58+
'field_other_date' => 'dcterms:date',
59+
],
60+
'field_related_item' => [
61+
'field_title' => 'dcterms:relation',
62+
'field_url' => 'dcterms:relation',
63+
],
64+
];
65+
66+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace Drupal\pcdora\Plugin\dgi_migrate_alter\spreadsheet;
4+
5+
use Drupal\dgi_migrate_alter\Plugin\MigrationAlterBase;
6+
use Drupal\dgi_migrate_alter\Plugin\MigrationAlterInterface;
7+
8+
/**
9+
* Alter for dssi_node migration.
10+
*
11+
* @MigrationAlter(
12+
* id = "pcdora_dssi_node_alter",
13+
* label = @Translation("DSSI Node Migration Alteration"),
14+
* description = @Translation("Alters the DSSI Node migration."),
15+
* migration_id = "dssi_node"
16+
* )
17+
*/
18+
class DssiNodeAlter extends MigrationAlterBase implements MigrationAlterInterface
19+
{
20+
21+
/**
22+
* {@inheritdoc}
23+
*/
24+
public function alter(array &$migration): void
25+
{
26+
$process =& $migration['process'];
27+
28+
$process['field_origin_information'][2]['values']['field_date_note'] = [
29+
[
30+
'plugin' => 'skip_on_empty',
31+
'method' => 'process',
32+
'source' => 'parent_value/date_text',
33+
],
34+
[
35+
'plugin' => 'dgi_migrate.process.explode',
36+
'delimiter' => '^',
37+
],
38+
];
39+
}
40+
41+
}

0 commit comments

Comments
 (0)