Issue #1836860 by attiks, durgesh_singh, Jelle_S, nod_, vks7056, Wim Leers: Picture doesn't work with AJAX callback

8.0.x
Alex Pott 2015-09-26 13:47:40 +02:00
parent cec8f5eb30
commit 3473bd5d3a
3 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,16 @@
(function (Drupal) {
"use strict";
/**
* Call picturefill so newly added responsive images are processed.
*/
Drupal.behaviors.responsiveImageAJAX = {
attach: function () {
if (window.picturefill) {
window.picturefill();
}
}
};
})(Drupal);

View File

@ -0,0 +1,4 @@
ajax:
version: VERSION
js:
js/responsive_image.ajax.js: {}

View File

@ -475,3 +475,14 @@ function _responsive_image_image_style_url($style_name, $path) {
}
return file_create_url($path);
}
/**
* Implements hook_library_info_alter().
*
* Load responsive_image.js whenever ajax is added.
*/
function responsive_image_library_info_alter(array &$libraries, $module) {
if ($module === 'core' && isset($libraries['drupal.ajax'])) {
$libraries['drupal.ajax']['dependencies'][] = 'responsive_image/ajax';
}
}