I want to create (with PHP) a paragraph library item, which are listed here: /admin/content/paragraphs
I have a paragraph type "paragraph_text_simple" which has this field (text formatted long): "field_paragraph_text_long".
I think, first, I have to create a paragraph:
$paragraph = Paragraph::create([
'type' => 'paragraph_text_simple',
'field_paragraph_text_long' => [
'value' => "My global paragraph Text",
'format' => 'basic_html',
]
]);
That seems to work.
Then I think I have to use this paragraph as target (created paragraph has the ID 1)?
\Drupal::entityTypeManager()->getStorage('paragraph')->create([
'type' => 'paragraphs_library_item',
'langcode'=>'en',
'label'=>'My global paragraph',
'parent_id' => 1,
'parent_type' => 'paragraphs_library_item'
]);