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
|
@ -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
Add a link
Reference in a new issue