Why Choose Paragraphs For Your Drupal Site?

Blog Article

Why Choose Paragraphs For Your Drupal Site?

 August 13th, 2019

Paragraphs allows the website builder to make things cleaner so that you can give more editing power to your end-users.  Instead of putting all their content in one WYSIWYG (what you see is what you get) body field (including images and videos), end-users can now choose between pre-defined paragraph types independent from one another.

Paragraph types can be anything you want from a simple text block or image to a complex and configurable slideshow.  Paragraphs includes a field type that works like Entity Reference.  You can add a new Paragraphs field on any content type you want and you can choose which Paragraph types (and you can add as many Paragraphs items as you allow) should be available to end-users.

Paragraphs does not come with any default paragraph types.  However, since they are basic Drupal entities, you can have complete control over what fields they should be composed of and what they should look like through the typical Drupal manage fields and manage display screens.

You can also add custom option fields and do conditional coding in your CSS, JS and pre-process functions so that end-users can have more control over the look and feel of each item.  The results end up being cleaner and more stable, rather than adding inline CSS or classes inside the body field's source.


•    Add a block of text with an image left to it

•    Add a slideshow between blocks of text

•    Add a YouTube embed between your text

•    Add quotes between your content blocks

The Drupal 8 version of the Paragraphs module is a complete rewrite of the D7 module.  Although it is based on the 'Entity Reference' module that is now in core, Paragraphs also requires the addon module Entity Reference Revisions.

Paragraphs defines:

•    A selection method for the Entity Reference field

•    A widget for the Entity Reference Revisions field

•    Paragraph types


The default paragraphs template is in paragraph.html.twig.  It uses theme suggestions for other templates, the following suggestions are available:

•      paragraph__[view_mode] (e.g. paragraph--default.html.twig)

•      paragraph__[type] (e.g. paragraph--image.html.twig)

•      paragraph__[type]__[view_mode] (e.g. paragraph—image--default.html.twig)


The Paragraphs module works within a multi-language setup but there are crucial things which you need to be aware of.  Translatable paragraph fields on the parent entity are not supported.  This might sound confusing or misleading, but it depends where the translatable option is enabled.  It is totally legit, that the fields on the paragraphs item entity itself are translatable, but not the paragraph field on the parent entity (e.g. Node, Taxonomy term, etc).

When activating translation on the parent entity on the "Content-Language" at admin/config/regional/content-language, the default setting of paragraph fields is the wrong one. You should disable the translatable option immediately.  To correctly enable the translation of paragraphs, click paragraphs on top of the 'content language' page (admin/config/regional/content-language) then scroll down (without saving!) near the bottom of the page and check the paragraph types you want to enable translation and each field for the paragraph type.  By default, all fields will be checked - which might not be correct!  Also, never enable translation on the Paragraphs field (Entity reference revisions).  Also (as it will enable the possibility to add new paragraphs while translating), if an empty field (not containing any paragraph field) is on the translation source node – this is not supported.  All paragraph types must be marked as translatable; specifically, also container paragraph types that only have an untranslatable paragraph field for nested paragraphs.  Otherwise, it is not possible to translate nested paragraphs in these fields.


Paragraphs is a great tool that will help make things cleaner so that you can give more editing power to your end-users.  If the Paragraphs module sounds like something you could use, you should consider looking further into utilizing Paragraphs to aid in your site development.

View More Articles