Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

A Drupal 10 module to allow the export of Paragraph Types into a self-contained submodule.

The Problem

Lets say you have site that utilizes the Drupal Paragraphs module. You create Paragraph Types as 'self-contained' components to add to pages on the site. Now lets say we want to take one of these Paragraph Types and use it on another Drupal site.

We would have to find all the configurations for it (Paragraph, Field, and Field Storage), find it's template and associated CSS/JS, and lastly any preprocess code needed to make the component work properly. Depending on the state of the codebase the process of migrating a Paragraph Type to another site could be tedious.

The Solution

What if we bundle Paragraph Types into a module? This idea is not revolutionary, but the aim of this module is to make the process of bundling Paragraph Types into a module easier by allowing a user to export existing Paragraph Types through the GUI and via the functionality in this module, a submodule will be created for the Paragraph Type that does the following:

  • Creates a new module directory within the Paragraphs Component Library module with a corresponding paragraph_type.info.yml file.
  • Create a template directory and corresponding paragraph--paragraph_type.html.twig file.
  • Create a paragraph_type.module file with scaffolding code to attach the custom template.
  • Finds and compiles all the needed configurations for the Paragraph Type and adds them to a /config/optional directory within the module.
  • Creates JS/CSS files which are attached via the template automatically.
  • A paragraph_type.libraries.yml is automatically created and generated via this process also.

All the tools needed to export an existing Paragraph Type into a module should be included in this base module.

How to Export a Paragraph Type

Right now a form can be accessed at the /admin/structure/paragraphs_type/{paragraph_type}/export route which will allow the Paragraph Type to be exported.

Notes

This is a minimum viable product version 0.0.1. and has not been fully tested.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Nov 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.0 Stable Nov 14, 2024