When using Linkit with modules such as Media (https://www.drupal.org/project/media) and Dialog (https://www.drupal.org/project/dialog), and enabling JavaScript aggregation in the Drupal Performance settings, ajax does not load properly. This causes issues such as:
* Views with ajax enabled are broken
* Rich text editor fails loading
* Administrative menus never load
* Linkit modal window never finishes fully rendering (jQuery UI doesn't run causing modal window to be disabled)
The problem is the use of this dependency code when loading the Linkit base library:
'dependencies' => array(
array('system', 'ui.dialog'),
array('system', 'drupal.ajax'),
),
... combined with the fact that modules such as Dialog need to replace the default Drupal ajax.js
file with their own version. When aggregation is enabled, Linkit expects the standard misc/ajax.js
to exist, but it has already been replaced.
The way to avoid this is to set explicit dependencies on the Linkit dashboard and autocomplete JavaScript files, to ensure they always load. This eliminates the errors, and allows Linkit, Media, Dialog, and general JavaScript loading to play nicely together.
Please review the attached patch. I'm open to approaching this another way if someone feels there is a better solution. Thanks.
Comment | File | Size | Author |
---|---|---|---|
linkit-modules_replace_drupal_ajax-1.patch | 874 bytes | ron_s |
Comments
Comment #2
anonThanks for patch.
Comment #4
mr.york CreditAttribution: mr.york at Agence Inovae commented