Creating paragraph entities and adding to a node I am using the Paragraph module in and I need to programmatically create paragraph entities and attach them to nodes.

Using the following code in a for-loop:

$paragraph = new ParagraphsItemEntity(array('field_name' =&gt; 'field_page_body', 'bundle' =&gt; 'text'));
$paragraph-&gt;is_new = TRUE;
$paragraph-&gt;setHostEntity('node', $node);
$paragraph-&gt;save(TRUE);


The paragraph entities are created and attached to the target node but the data is NULL for all 3 entries as the image below shows:



A properly working set of Paragraph entities attached to a node look like the following:



So, instead of UND i:e undefined, I am trying to attach programmatically created arrays of paragraph entities to my nodes.

Can anyone advice how I can modify my code to include my array of Paragraphs data?
I have a similar function and would recommend that if you already know what language your node is, you capture it from the node and use it for the language in the paragraph field. I only had 1 language to worry about but you could easily replace LANGUAGE_NONE('und') with the appropriate language code from the node.

$paragraph = new ParagraphsItemEntity([
  'field_name' =&gt; $host_field_name,
  'bundle'     =&gt; $para_bundle,
]);
$paragraph-&gt;is_new = TRUE;
$paragraph-&gt;setHostEntity('node', node_load($this-&gt;node-&gt;nid));
$paragraph-&gt;field_long_text[LANGUAGE_NONE][0]['value'] = $field_content;
$paragraph-&gt;field_long_text[LANGUAGE_NONE][0]['format'] = 'wysiwyg';
$paragraph-&gt;save();