What are the functionalities and usage of the Paragraph Module


The Drupal 8+ Paragraphs module is a complete rewrite of the D7 module. Although based on the Entity Reference module in core, Paragraphs requires the Entity Reference Revisions module .

The Drupal Paragraphs module can make processes like these much more manageable for non-technical users while also giving developers the ability to control the formatting and appearance of such specially formatted elements at the theme level.

In practice, Paragraphs allows us to insert elements much like content fields, but instead of adding these around the body of any given piece of content, they are effectually inserted throughout the body.

Paragraphs defines

  • A selection method for the Entity Reference field
  • A widget for the Entity Reference Revisions field
  • Paragraph types

Features

This module has some overlapping functionality with field_collection, but this module has some advantages over field_collection.

  • Different fields per paragraph bundle
  • Using different paragraph bundles in a single paragraph field
  • Displays per paragraph bundle
  • Bundles are exportable with features.
  • Entities, so: exportable field bases/instances, usable in Search API, usable in View
Theming Paragraphs in Drupal 8

Paragraphs uses template naming suggestions like core Drupal modules. The default paragraphs template is provided in paragraphs/templates/paragraph.html.twig.

The following suggestions are available, from most specific (used first) to least specific:

  1. paragraph--[type]--[view-mode].html.twig  (e.g. paragraph--image--default.html.twig)
  2. paragraph--[type].html.twig (e.g. paragraph--image.html.twig)
  3. paragraph--[view-mode].html.twig (e.g. paragraph--default.html.twig)
  4. paragraph.html.twig

After adding a template, you must rebuild the cache in order for Drupal to discover your new template.

It is possible to create custom template name suggestions using the hook_theme_suggestions_HOOK_alter() function.

No comments:

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...