Skip to content
Snippets Groups Projects
Commit 62ec0b76 authored by Gaus Surahman's avatar Gaus Surahman
Browse files

Added blazy bio.ajax library only if both core drupal.ajax and blazy exist.

parent 3323a373
No related branches found
No related tags found
No related merge requests found
Pipeline #559211 passed with warnings
Blazy 3.0.x-dev, 2025-07-29
---------------------------
- Added blazy bio.ajax library only if both core drupal.ajax and blazy exist.
Blazy 3.0.x-dev, 2025-03-19
---------------------------
- git commit -m 'Issue #3513440 by bgreco: Responsive image preloads
......
......@@ -56,13 +56,20 @@ class BlazyAlter {
* Implements hook_library_info_alter().
*/
public static function libraryInfoAlter(&$libraries, $extension): void {
static $bajax;
// @todo remove if core changed, right below core/drupal for being generic,
// and dependency-free and a dependency for many other generic ones.
// @todo watch out for core @todo to remove drupal namespace for debounce.
$debounce = 'drupal.debounce';
if ($extension === 'core' && isset($libraries[$debounce])) {
if ($extension === 'core') {
if (isset($libraries[$debounce])) {
$libraries[$debounce]['js']['misc/debounce.js'] = ['weight' => -16];
}
if (!isset($bajax) && isset($libraries['drupal.ajax'])) {
$bajax = TRUE;
}
}
if ($extension === 'media' && isset($libraries['oembed.frame'])) {
$libraries['oembed.frame']['dependencies'][] = 'blazy/oembed';
......@@ -98,6 +105,11 @@ class BlazyAlter {
$libraries['dblazy']['dependencies'][] = 'blazy/dompurify';
}
}
// Add blazy/bio.ajax only if both core drupal.ajax and blazy exist.
if (isset($bajax) && isset($libraries['load'])) {
$libraries['load']['dependencies'][] = 'blazy/bio.ajax';
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment