Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Drupal 11.4.6 Update released for Drupal core (11.4.6)! Release: Drupal 10.6.16 Update released for Drupal core (10.6.16)! Release: PhotoSwipe - Responsive JavaScript Modal Image Gallery 5.0.10 Minor update available for module photoswipe (5.0.10). Release: Twig Tweak 4.0.0-alpha5 New alpha version released for module twig_tweak (4.0.0-alpha5). Release: Advanced Varnish 4.2.0 Minor update available for module adv_varnish (4.2.0). Release: Path File 2.2.0 Minor update available for module path_file (2.2.0). Release: Media PDF Thumbnail 6.1.10 Minor update available for module media_pdf_thumbnail (6.1.10). Release: Rigel 8.0.0 Major update available for theme rigel (8.0.0). Module Revived: Media PDF Thumbnail 7.0.1 Module media_pdf_thumbnail updated after 15 months of inactivity (7.0.1). Security Coverage: Unrestricted Page Module unrestricted_page now has official Drupal security advisory coverage.

Paragraphs library browser filter

No security coverage

Part of the Paragraphs ecosystem · 63 projects

View on drupal.org

This module filters the "Add from library" paragraph browser to only show paragraph types that are allowed by the parent field. It also filters the type dropdown in the browser to match these allowed types, preventing users from adding paragraphs that are not permitted.

Note: this module is created by Github Copilot (with LLM model Claude Opus 4.6 - high thinking).

Filters the paragraphs library browser by allowed paragraph types from the
parent entity reference revisions field.

Problem

When adding a "From library" paragraph to an `entity_reference_revisions` field that restricts allowed paragraph types, the library browser modal shows all available library items regardless of the parent field's configuration. The exposed Type dropdown also lists all paragraph types.

Solution

This module ensures the library browser only shows library items whose paragraph type is allowed by the parent field. It also filters the exposed Type dropdown to match.

How it works

  1. Widget alter — When the `from_library` paragraph's `field_reusable_paragraph` widget renders, the module reads the allowed paragraph types from the parent `entity_reference_revisions` field and injects them into the entity browser's `widget_context`. This data is stored in the entity browser selection storage (keyed by UUID).
  2. Query alter — When the `paragraphs_library_browser` view executes, the module reads the allowed types from selection storage (via the `uuid` query parameter) and adds a `WHERE type IN (...)` condition to filter results.
  3. Exposed form alter — The Type dropdown in the exposed filter form is filtered to only show allowed paragraph types.

The `uuid` query parameter is preserved across Views AJAX requests (exposed filter submit, paging) because Drupal core's `ajax_view.js` forwards iframe query parameters to AJAX endpoints.

Requirements

Installation

  1. Place the module in your modules directory (e.g. `modules/custom/`).
  2. Enable it:
    drush en paragraphs_library_browser_filter
  3. Clear caches:
    drush cr

No additional configuration is required. The filtering activates automatically
for any `entity_reference_revisions` field that has allowed paragraph types
configured and includes the `from_library` type.

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
Apr 2026
Latest release
4 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.x-dev Dev 10–11 Apr 22, 2026