Problem/Motivation

When an Entity Browser opens a View inside a modal, Drupal sets _wrapper_format=drupal_modal on the request. Views detects this wrapper format and automatically adds data-dialog-type="modal" and data-accepts="application/vnd.drupal-modal" attributes to all links it renders including pager links.

As a result, clicking a pager link inside the Entity Browser modal does not paginate the View. Instead, Drupal intercepts the click and attempts to re-open the current request in a new modal popup, breaking pagination entirely.

Steps to reproduce

1. Create an Entity Browser that uses a View with paging enabled as its widget.
2. Open the Entity Browser modal.
3. Click any pager link (next, previous, or a page number).
4. Instead of paginating, the modal closes and/or a new modal is opened with the same or broken content.

Proposed resolution

Add a hook_preprocess_pager() implementation that strips data-dialog-type, data-accepts, and data-dialog-optionsattributes from pager links when rendering in an Entity Browser context.

This is the correct fix because:
- The _wrapper_format=drupal_modal must remain on the initial request for the modal to open correctly.
- Changing the wrapper format is not an option at this stage of the request lifecycle.
- The dialog attributes on pager links serve no useful purpose inside an Entity Browser modal and actively cause broken behaviour.
- Scoping the fix to Entity Browser routes (e.g. by checking entity_browser in the current route name) ensures no other legitimate modal use cases are affected.

Remaining tasks

  • Review and test the hook_preprocess_pager() implementation
  • Verify the correct route name scoping for all Entity Browser widget types
  • Add automated test coverage for pager behaviour inside Entity Browser modals

User interface changes

Pager links inside an Entity Browser modal will no longer trigger a new modal dialog. Pagination will work as expected.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
views-pager-modal-issue.patch1.53 KBremco hoeneveld
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

remco hoeneveld created an issue. See original summary.

remco hoeneveld’s picture

Issue summary: View changes

remco hoeneveld’s picture