Phrases that You Need to Understand When Talking to a Drupal Developer: Paragraphs and Entities
This is the fourth post in the series. This time I will explain the word Entity and describe the principle of operation of one of the most popular modules – Paragraphs.
The most commonly used phrases related to Drupal
Other articles of this series can be found here:
- Phrases that you need to understand when talking to a Drupal developer: Node
- Phrases that you need to understand when talking to a Drupal developer: Field & Block
- Phrases that you need to understand when talking to a Drupal developer: Module and Taxonomy
Paragraphs is a Drupal module that needs to be installed before use. It is a seemingly simple module that offers the content editors of Drupal websites great possibilities. At Droptica, we have built the Droopler distribution based on this module, among others.
In one of the previous texts, I have described the fields. The fields allow you to plan the structure of the form for creating a given subpage, and this translates into the appearance of that given subpage.
Let us assume that you want to have a subpage with a large banner (photo) with text. You can add an Image field and a Text field in order to collect the necessary data.
However, what if you want to have more such banners on one subpage? Or if you want a banner, then text, then a banner again, and then text again? It is not possible to plan all possible combinations with the Fields module.
This is where the Paragraphs module may help. It allows you to build the paragraph types that will then be used during the content creation (Node).
You can create a Banner type paragraph, add 2 fields in it: image and text. In addition, let us make a second paragraph named text with a single text box.
Then add a Paragraphs field to the [Node | link]. At this point, you can build your content from components – from paragraphs. On one subpage you can start with a banner and add text below. On another, you can just add text. On another – add 2 banners and text.
I always compare the Paragraphs module to a Lego bricks factory. First, define what blocks you want to have in the factory. Then you can produce how many blocks of a given type you want and build content from them.
Watch the video on the Droopler website or on our YouTube, channel in order to understand the concept behind the Paragraphs module better.
If you are building a website with many long landing pages, I definitely recommend the Paragraphs module.
Entity is a word that has been already used in this entry. Entity is something to keep data in.
In the Drupal core, there are such entities as:
- User (user accounts)
It is good to know that the programmer can also define his own type of Entity. Sometimes this is better than using a Node entity with additional fields, e.g. for performance reasons.
This situation is more common when Drupal is a backend system, but it can also happen when building a corporate website. It is good to know then that in the system, there may be something like a dedicated entity created by the developer to hold a specific type of data.
I hope that after reading all entries you will understand the world of Drupal better and that the implementation of tasks you entrust to the Drupal developers will be much more efficient.