Introduction To Paragraphs Drupal 8 Skip to main content

Paragraphs Drupal 8

Saurabh Dhariwal

Saurabh Dhariwal

Introduction to Paragraphs Drupal 8

Paragraphs is a contributed module which allows creation, administration, and display of customizable content components. In other words, Paragraphs gives you cleaner data structures so you can give more editing power to your end-users. 

This module replaces drupal’s standard body field with paragraph types. This allows any type of content to be added on the page including but not limited to HTML, images, videos etc. All these can be added by users. Users can add as many paragraphs as they like all the while keeping them all responsive. Developers can reuse paragraphs and layouts. 

Paragraphs are basic Drupal entities. This allows site builder control over fields used in paragraphs and their display. This also makes content saved in paragraphs compatible with Search API, views, and services. 

Below is the step by step instructions to work with Paragraphs module:

1 - Download and enable the module
Paragraphs module follows standard process to download and enable.  Module depends on entity reference revision. You can download and enable this module via drush as well.

2 - Add paragraph types
Paragraphs do not come with any predefined paragraph types. Developers can add as many paragraph types they want by going to admin > structure > paragraphs

Introduction to Paragraphs Drupal 8

To add a paragraph, click on “Add paragraph”. Add fields 

Introduction to Paragraphs Drupal 8

Add fields that you want in this paragraph. Go to manage form display and manage display to adjust field display.

3 - Add paragraph field in the content type

Add paragraph field in the content type. 

Introduction to Paragraphs Drupal 8

Allow this field to have multiple values. Select which paragraphs you want available in this field on field settings and save.

4 - Add content

Add content. In paragraph field, you get a list of all the paragraphs you have created and are available for this field. Add as many paragraphs as you need. You can change the order as well.

Introduction to Paragraphs Drupal 8

5 - Theme your paragraphs

Paragraphs can be themed separately. You can use the same template everywhere this paragraph is used.  The file name needs to 

“Paragraph--machine-name-of-your-paragraph.html.twig”

Summary

Paragraph provides various advantages to all users of the site. Site owners get content that is responsive and works on all platforms. Content authors can choose on the fly between predefined paragraph types. They get more structured content creation process. Developers have full control over fields to include and paragraphs and how they should look.

Stay tuned for more on paragraphs!

Hope this helped you to get most out of the system. Feel free to share your reviews or need assistance for Drupal Website Migration then get in touch with us. Pick the best answer for your requirements.