I am in a situation where I would like to split out Paragraph entities to separate forms.

Edit forms are no problem:

$entity = Paragraph::load($entity_id);
return \Drupal::service('entity.form_builder')->getForm($entity);

But how do I get the create form? So far I have this:

$entity = Paragraph::create();
return \Drupal::service('entity.form_builder')->getForm($entity);

... but the information about the node and field to attach the paragraph entity to is needed.

Thank you

1 Answer 1


The only information you need to get the create form of a content entity is the bundle (if the entity has bundles):

$entity = Paragraph::create(['type' => 'my_paragraph_type']);
return \Drupal::service('entity.form_builder')->getForm($entity);

You can do the rest after submitting, but you need to update both, the information of the parent entity in the paragraph and vice versa. Paragraphs references are bi-directional.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.