I'm creating a new paragraph item within a hook_node_presave() function.
The paragraph item is fairly simple, just a title and body text written into a text field with full html text editing. When I attempt to html elements within the body text, I'm unable to get the content to render the HTML tags.
Is there a way to do this using a render array, or another technique?
This is my initial attempt to build the paragraph, putting my html tags directly into the field that contains the body content.
$summary_paragraph = Paragraph::create([
'type' => 'paragraph_text', //this is the paragraph type
'field_title' => 'Title text',
'field_content' => '<p>Sentence one.</p><p>Sentence two</p>.',
]);
The title appears correctly and field_content prints the tags along with the text.
I also tried with a render array.
$content_text = [
'#type' => 'processed_text',
'#text' => '<p>Paragraph one.</p><p>Paragraph two.</p>',
'#format' => 'full_html',
];
$summary_paragraph = Paragraph::create([
'type' => 'paragraph_text', //this is the paragraph type
'field_title' => 'Title text',
'field_content' => $content_text,
]);
In this case, only the title was printed.