The default value of "field_publication_date" is now the created date
In the issueindex and node story migrations
This commit is contained in:
parent
e86c9d99ec
commit
b9d4c3c0a4
3 changed files with 35 additions and 2 deletions
|
@ -165,9 +165,11 @@ process:
|
|||
# process:
|
||||
# target_id: tid
|
||||
field_publication_date:
|
||||
- plugin: publication_date_default
|
||||
source: field_publication_date
|
||||
method: process
|
||||
-
|
||||
plugin: sub_process
|
||||
source: created
|
||||
process:
|
||||
value:
|
||||
plugin: format_date
|
||||
|
|
|
@ -213,8 +213,11 @@ process:
|
|||
# target_id: tid
|
||||
field_publication_date:
|
||||
-
|
||||
plugin: sub_process
|
||||
plugin: publication_date_default
|
||||
source: field_publication_date
|
||||
method: process
|
||||
-
|
||||
plugin: sub_process
|
||||
process:
|
||||
value:
|
||||
plugin: format_date
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?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 = "publication_date_default",
|
||||
* handle_multiples = TRUE
|
||||
* )
|
||||
*/
|
||||
class PublicationDateDefault extends ProcessPluginBase {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
$created_date = $row->getSourceProperty('created');
|
||||
if (empty($value)) {
|
||||
$value = [0 => ['value' => date('Y-m-d\TH:i:s', $created_date)]];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue