Migrate the bio field in the story migration.
This commit is contained in:
parent
9108d898df
commit
7b0ff5e881
2 changed files with 43 additions and 4 deletions
|
@ -156,6 +156,20 @@ process:
|
|||
target_id: fid
|
||||
display: display
|
||||
description: description
|
||||
_field_bio:
|
||||
plugin: geo_story_bio
|
||||
source:
|
||||
- field_author
|
||||
- field_author_bio
|
||||
field_biography:
|
||||
plugin: sub_process
|
||||
source: '@_field_bio'
|
||||
process:
|
||||
target_id:
|
||||
plugin: migration_lookup
|
||||
source: value
|
||||
migration: upgrade_d7_node_story_author
|
||||
override: bio
|
||||
field_authors:
|
||||
plugin: sub_process
|
||||
source: field_author
|
||||
|
@ -177,10 +191,6 @@ process:
|
|||
# title: title
|
||||
# width: width
|
||||
# height: height
|
||||
# field_author_bio:
|
||||
# -
|
||||
# plugin: get
|
||||
# source: field_author_bio
|
||||
# field_citiations:
|
||||
# -
|
||||
# plugin: get
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Drupal\geo_upgrade\Plugin\migrate\process;
|
||||
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\MigrateSkipRowException;
|
||||
use Drupal\migrate\ProcessPluginBase;
|
||||
use Drupal\migrate\Row;
|
||||
|
||||
/**
|
||||
* @MigrateProcessPlugin(
|
||||
* id = "geo_story_bio"
|
||||
* )
|
||||
*/
|
||||
class StoryBio extends ProcessPluginBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
$result = [];
|
||||
foreach ($value[0] as $key => $item) {
|
||||
$result[$key] = $item;
|
||||
$result[$key]['bio'] = isset($value[1][0]['value']) ? $value[1][0]['value'] : '';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue