0

I would like for users to be able to create new paragraph entities within the form of a custom block instead of going into the linked content type and adding the content.

In the past, I've always used the elements from this list but unfortunately it doesn't seem like there is an option for that.

Has anyone ever built anything similar to what I'm describing?

Thanks.

  • Why is the form API not sufficent for this? Paragraphs itself uses the same list. The form API allows to edit fields, and entities like Paragraphs use fields to store the data. – Hudri Jan 24 at 9:13
2

The easiest idea I could come up with would be to define the paragraph type through the UI. Then you'd have 2 options:

  1. whether make a custom form with similar fields and create a new paragraph entity on form submission.
  2. define a content type which has reference field to the paragraph type. Then you could simply render the node form which would handle all the logic of displaying the fields and saving of the paragraph it self.

I would prefer option number 2 since paragraphs are not meant to be stand-alone entities. They are meant to be parts of content. IMHO I don't think one paragraphs entity should be reused on multiple nodes.

  • Yes, Paragraphs are required to be used in an entity revision field and therefore can't be stand-alone entities. So number 2 is the way to go. You can add the field to a custom block type as well, which would be the most straightforward way to display paragraphs in a block. – 4k4 Jan 24 at 7:38
  • Awesome! Thank you so much, the answer in the first link was exactly what I was looking for. – Jake Stewart Jan 24 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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