Entity browser modals are incompatible with Bootstrap modals

Created on 1 February 2024, 11 months ago

Problem/Motivation

This may be a pretty specific issue, but I'm using entity browser modals along with the Bootstrap theme, which let's you use its own modal system rather than core dialogs. In this case, Entity Browser wrongfully assumes that it can access certain dialog option attributes, which are not available on the Bootstrap modals.

Steps to reproduce

- Create an entity browser using the Modal display plugin
- Use Bootstrap as theme and enable Jquery UI Modal bridge
- Entity browser button will be unable to open the modal with the following error in the console:

Uncaught TypeError: Cannot read properties of undefined (reading 'options')
    at HTMLDivElement.<anonymous> (entity_browser.modal.js?s86hmi:97:18)
    at Function.each (jquery.min.js?v=3.7.1:2:3129)
    at ce.fn.init.each (jquery.min.js?v=3.7.1:2:1594)
    at Drupal.entityBrowserModal.fluidDialog (entity_browser.modal.js?s86hmi:93:14)
    at entity_browser.modal.js?s86hmi:64:35
    at dispatch (jquery.min.js?v=3.7.1:2:40035)
    at v.handle (jquery.min.js?v=3.7.1:2:38006)

Proposed resolution

Add a nullcheck when accessing the dialog configuration.

      var dialog = $this.find('.ui-dialog-content').data('ui-dialog');

      if (dialog.options.fluid) {

Becomes

      var dialog = $this.find('.ui-dialog-content').data('ui-dialog');

      if (dialog && dialog.options.fluid) {
🐛 Bug report
Status

Active

Version

2.10

Component

Display plugins

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024