protonsystems/paragraph-info

Reusable Drupal 11 module exposing stable paragraph anchor IDs and a permission-gated paragraph info overlay.

Maintainers

Package info

gitlab.com/Proton.Systems/drupal/paragraph-info

Issues

Type:drupal-module

pkg:composer/protonsystems/paragraph-info

Transparency log

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.2 2026-08-14 10:37 UTC

This package is auto-updated.

Last update: 2026-08-14 15:39:32 UTC


README

This repository contains a reusable Drupal 11 module for exposing stable paragraph anchor IDs and, for permitted users, a toggleable paragraph info overlay.

Purpose

The module is intended to be reused across Drupal 11 projects by installing it as a Composer package and enabling it in the target site.

Requirements

  • Drupal 11
  • Paragraphs

Features

  • Generates a canonical anchor for every rendered paragraph using: paragraph-{bundle}-{id}
  • Exposes an opt-in paragraph info label for themes to render for users with the view paragraph info permission
  • Adds a frontend toggle on non-admin pages
  • Persists the toggle state in browser localStorage

Example anchor:

  • #paragraph-text-42

Structure

  • paragraph_info.module contains the theme, page, and preprocess hooks.
  • src/ contains the markup builder service.
  • templates/ contains the label and toggle Twig templates.
  • css/ and js/ contain the frontend toggle behavior.

Installation

composer require protonsystems/paragraph-info

Then enable the module in Drupal:

drush en paragraph_info

Grant the View paragraph info permission to the desired roles, then rebuild caches.

Theme Integration

Use the paragraph_info_anchor_id variable in paragraph templates for the wrapper id, and render paragraph_info_label where the info label should appear.

Example:

<div id="{{ paragraph_info_anchor_id }}">
  {{ paragraph_info_label }}
</div>

The module no longer prepends the label to every paragraph automatically. Labels only render where the paragraph template explicitly outputs paragraph_info_label.

If a project already has theme-specific paragraph info labels or toggles, remove them to avoid duplicate UI.

Notes

The module currently uses Drupal core services directly and is designed to be consumed as a standard Drupal module package.