Learn about the Paragraphs module and how you should use it.
We’ll cover the following:
- Learn what Paragraphs is
- Download and install Paragraphs module
Composer command
composer require drupal/paragraphs
Transcript
Trainer (00:00):
Here is the product edit form, and you can see all of the fields that we have created. You’ve learnt just how easy it is throughout this course to attach fields to content types. But what if you want to group fields together? Now, I’m not talking about the field group module which we used to create these tabs and group these field widgets. What if we want to create a product attributes field, which we could use to add a size and color for this product, and we can specify multiple sizes and colors? To implement this functionality, we can use a module called paragraphs.
Trainer (00:39):
If you want to learn more about the module, just head over to drupal.org/project/paragraphs. The module allows you to create reusable paragraph types which are fieldable. So we can add a select list, text area, text field, any field you can add to a content type can be added to a paragraph.
Trainer (01:00):
Often paragraphs are used to create slide shows, accordions, or even embed forms. But I like to also use them to group fields. So if you have a requirement to group fields together, then take a look at the paragraphs module. But for our sites, we’ll use it to define some product attributes.
Trainer (01:20):
Before we can do anything, let’s go ahead and download the module. So jump into your terminal, and then download the module using composer. So type in “composer require drupal/paragraphs. The paragraphs module requires entity reference revisions. That is why that module has also been downloaded.
Trainer (01:43):
Once the module has been downloaded, let’s jump back to our site, and I will close this tab. Then go to extend, and we’ll search for paragraphs. Then check paragraphs, and click on install. Then just click on continue.