- Issue created by @taitai
- š®š±Israel taitai
Code:
// Set the abstracts array
foreach($abstracts['abstract'] as $key => $abstract){
$abs_items [] = '
Insight ' . $ins_items[$key] . '
' . $abstract;
}
// Set the field
$Node->set('field_design_abstract',$abs_items);
$Node->save(); Did you try?:
foreach($abstracts['abstract'] as $key => $abstract){ $abs_items [] = [ 'value' => '<p class="ins_t">Insight ' . $ins_items[$key] . '</p>' . $abstract, 'format => 'full_html', ]; } // Set the field $Node->set('field_design_abstract',$abs_items); $Node->save();
- š®š±Israel taitai
Your #4 works fine, thanks. However...2 questions: 1. Why do you need to set the format explicitly as the field itself already defines the allowed format 2. I used the following which did not work.. $Node->field_design_abstract = $abs_items; $Node->field_design_abstract->format = 'full_html';
Iām glad I could help. You should examine the field values programmatically to see why this is the correct way.