Drupal is a registered trademark of Dries Buytaert
cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)! drupal 10.6.9 Update released for Drupal core (10.6.9)! drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)!

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.

Activity

Total releases
1
First release
Apr 2026
Latest release
1 month ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.x-dev Dev Apr 22, 2026