Repeatable fieldsets in Drupal: Paragraphs

para

I've talked about a couple of modules to handle repeatable fieldsets before, with a comparison between Field Collections and Inline Entity Form. At Drupal Camp London this year I learnt about a new method: Paragraphs. Below I'll go through the basic setup and implementation of the module comparing it to the previous modules I used.

In this example (as with previously) I'll be adding a page with the ability to add a list of pets. The available fields will be the pet name, image, type (term reference) and a long text description field. 

Creating the field

When you install the module you have a new field type 'Paragraph', and similar to field collections you'll also have an additional option under Structure: 'Paragraph bundles'. Unlike field collections you can add as many paragraph bundles as you want without having to create the field first. When adding a paragraph field to an entity you can select which bundle types can be selected and how you want the user to add new paragraphs.

Adding the content

Due to the ability to add different paragraph types/bundles you won't see the fields until you select one. In this instance I'm using buttons, the other option is to display a select list and a select button. 

Selecting your option will make the fields appear as expected. Required validation functions as you'd expect - unable to save the node as a whole until required fields are completed

 

Viewing the node

As with both the other modules this functions as you'd expect, displaying according to the 'manage display' settings.
 

Workbench Moderation

As with the latest version of field collections this functions out of the box with workbench moderation, the paragraph values are only published when the node is. You can see the draft and published version below.

The Result

Paragraphs looks like a very promising module, adding a great deal more flexibility than field collections (though at a heavier admin cost - updating each content type to allow new created paragraphs bundles or not). Working with revisioning out the box is an added bonus as well, though I've not tested with multilingual so be careful there. 

Going forward paragraphs will be my module of choice when I need to have repeatable field sets. Having you been using this for a while already and have things to watch out for? 

Until next time.