Add the "publication date" default value in the blog and gleaning types
This commit is contained in:
parent
b07c74d77e
commit
42d6b6c757
4 changed files with 24 additions and 2 deletions
|
@ -157,6 +157,17 @@ process:
|
|||
title: title
|
||||
width: width
|
||||
height: height
|
||||
field_publication_date:
|
||||
- plugin: publication_date_default
|
||||
source: field_publication_date
|
||||
method: process
|
||||
- plugin: sub_process
|
||||
process:
|
||||
value:
|
||||
plugin: format_date
|
||||
from_format: 'Y-m-d\TH:i:s'
|
||||
to_format: 'Y-m-d'
|
||||
source: value
|
||||
path/alias: source_path
|
||||
path/pathauto:
|
||||
plugin: default_value
|
||||
|
|
|
@ -98,6 +98,17 @@ process:
|
|||
target_id: fid
|
||||
display: display
|
||||
description: description
|
||||
field_publication_date:
|
||||
- plugin: publication_date_default
|
||||
source: field_publication_date
|
||||
method: process
|
||||
- plugin: sub_process
|
||||
process:
|
||||
value:
|
||||
plugin: format_date
|
||||
from_format: 'Y-m-d\TH:i:s'
|
||||
to_format: 'Y-m-d'
|
||||
source: value
|
||||
path/alias: source_path
|
||||
path/pathauto:
|
||||
plugin: default_value
|
||||
|
|
|
@ -173,7 +173,7 @@ process:
|
|||
process:
|
||||
value:
|
||||
plugin: format_date
|
||||
from_format: 'U'
|
||||
from_format: 'Y-m-d\TH:i:s'
|
||||
to_format: 'Y-m-d'
|
||||
source: value
|
||||
path/alias: source_path
|
||||
|
|
|
@ -20,7 +20,7 @@ class PublicationDateDefault extends ProcessPluginBase {
|
|||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
$created_date = $row->getSourceProperty('created');
|
||||
if (empty($value)) {
|
||||
if (!isset($value) || 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