Drupal is a registered trademark of Dries Buytaert
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)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). scheduler_content_moderation_integration 3.0.5 Minor update available for module scheduler_content_moderation_integration (3.0.... commerce 3.3.5 Minor update available for module commerce (3.3.5). geocoder 8.x-4.34 Minor update available for module geocoder (8.x-4.34). leaflet 10.4.5 Minor update available for module leaflet (10.4.5). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14).

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
20 hours ago
Release cadence
Stability
0% stable

Releases

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