popsu_migrate: D7NodeProgramme sous partie paragraphe ok (missing node-reference on events)

This commit is contained in:
Bachir Soussi Chiadmi 2021-04-16 15:37:37 +02:00
parent eba6068747
commit 85b5fcff6e
2 changed files with 42 additions and 6 deletions

View File

@ -62,12 +62,7 @@ process:
field_textes: text_paragraphe field_textes: text_paragraphe
# field_popsu_special_insert_intro field_sous_parties: sous_parties
# field_popsu_special_insert
# field_fichier:
# plugin: migration_lookup
# migration: d7_allpublicfiles
# source: fichiers
field_fichier: field_fichier:
plugin: sub_process plugin: sub_process

View File

@ -87,6 +87,47 @@ class D7NodeProgramme extends D7Programme {
$row->setSourceProperty('text_paragraphe', $text_paragraphe); $row->setSourceProperty('text_paragraphe', $text_paragraphe);
// Sous partie // Sous partie
// looping through special_type
$sous_parties = array();
foreach (['colloques', 'publications'] as $special_type) {
$ps = array();
// looping through nodes
foreach ($associateds[$special_type] as $key => $special) {
// looping through fields
foreach (['field_popsu_special_body', 'field_popsu_special_text'] as $field) {
if (!empty($special[$field])) {
// creating the sous partie contents (sub paragraphes)
$text = $special[$field][0];
$text[0]['format'] = 'wysiwyg';
$p = Paragraph::create(['type' => 'sous_partie_programme_contents']);
$p->set('field_texte', $text)
->set('field_titre', $special['title'])
// TODO ->set('field_liste_contenus',) migration_lookup on popsu_colloques -> evenements
->isNew();
$p->save();
$ps[] = array(
'target_id' => $p->id(),
'target_revision_id' => $p->getRevisionId(),
);
}
}
}
if (!empty($ps)) {
// creating sous partie (paragraphe)
$p = Paragraph::create(['type' => 'sous_partie_programme']);
$p->set('field_sous_partie_contenus', $ps)
->set('field_titre', $special_type)
->isNew();
$p->save();
$sous_parties[] = array(
'target_id' => $p->id(),
'target_revision_id' => $p->getRevisionId(),
);
}
}
if (!empty($sous_parties)) {
$row->setSourceProperty('sous_parties', $sous_parties);
}
// fichiers // fichiers
// files from current node // files from current node