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
|
title: title
|
||||||
width: width
|
width: width
|
||||||
height: height
|
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/alias: source_path
|
||||||
path/pathauto:
|
path/pathauto:
|
||||||
plugin: default_value
|
plugin: default_value
|
||||||
|
|
|
@ -98,6 +98,17 @@ process:
|
||||||
target_id: fid
|
target_id: fid
|
||||||
display: display
|
display: display
|
||||||
description: description
|
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/alias: source_path
|
||||||
path/pathauto:
|
path/pathauto:
|
||||||
plugin: default_value
|
plugin: default_value
|
||||||
|
|
|
@ -173,7 +173,7 @@ process:
|
||||||
process:
|
process:
|
||||||
value:
|
value:
|
||||||
plugin: format_date
|
plugin: format_date
|
||||||
from_format: 'U'
|
from_format: 'Y-m-d\TH:i:s'
|
||||||
to_format: 'Y-m-d'
|
to_format: 'Y-m-d'
|
||||||
source: value
|
source: value
|
||||||
path/alias: source_path
|
path/alias: source_path
|
||||||
|
|
|
@ -20,7 +20,7 @@ class PublicationDateDefault extends ProcessPluginBase {
|
||||||
*/
|
*/
|
||||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||||
$created_date = $row->getSourceProperty('created');
|
$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)]];
|
$value = [0 => ['value' => date('Y-m-d\TH:i:s', $created_date)]];
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue