Skip to content

Commit 360a389

Browse files
committed
BKDK-414 using status for moderation_state
1 parent 76c8fc7 commit 360a389

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

web/modules/custom/ballerup_d7_migration/config/install/migrate_plus.migration.ballerup_d7_node_indholdside.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ process:
3535
default_value: 1
3636
source: '@migrate_uid'
3737
status: status
38+
moderation_state:
39+
plugin: callback
40+
callable:
41+
- 'Drupal\ballerup_d7_migration\Utility\MigrationHelper'
42+
- setModerationState
43+
source: status
3844
created: created
3945
changed: changed
4046
#promote: promote

web/modules/custom/ballerup_d7_migration/config/install/migrate_plus.migration.ballerup_d7_node_institution_page.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ process:
3333
plugin: default_value
3434
default_value: 1
3535
source: '@migrate_uid'
36+
status: status
37+
moderation_state:
38+
plugin: callback
39+
callable:
40+
- 'Drupal\ballerup_d7_migration\Utility\MigrationHelper'
41+
- setModerationState
42+
source: status
3643
field_migration_old_url:
3744
plugin: callback
3845
callable:
@@ -46,7 +53,7 @@ process:
4653
value: value
4754
format:
4855
plugin: default_value
49-
default_value: 'wysiwyg_tekst'
56+
default_value: 'wysiwyg_tekst'
5057
# ...
5158
field_os2web_page_contact:
5259
plugin: migration_lookup

web/modules/custom/ballerup_d7_migration/src/Utility/MigrationHelper.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ function createUrlFromNid($nid) {
1818
return MigrationHelper::$siteUrl . '/node/' . $nid;
1919
}
2020

21+
/**
22+
* Sets the moderation state for the node based on a status.
23+
*
24+
* @param $status
25+
*
26+
* @return string
27+
*/
28+
function setModerationState($status) {
29+
if ($status) {
30+
return 'published';
31+
}
32+
else {
33+
return 'draft';
34+
}
35+
}
36+
2137
/**
2238
* Creates Borger.dk paragraph with the right article selected.
2339
*

0 commit comments

Comments
 (0)