function _picture_filter_process in Picture 7.2
Same name and namespace in other branches
- 7 picture.module \_picture_filter_process()
Process callback for inline image filter.
1 string reference to '_picture_filter_process'
- picture_filter_info in ./
picture.module - Implements hook_filter_info().
File
- ./
picture.module, line 1721 - Picture formatter.
Code
function _picture_filter_process($text, $filter) {
// Find all img tags with a data-picture-mapping attribute.
preg_match_all('/<img [^>]*data-picture-(mapping|group)\\s*=\\s*["\'][^>]*>/i', $text, $images);
if (!empty($images)) {
foreach ($images[0] as $image) {
// Create the render array expected by theme_picture_formatter.
$image_render_array = _picture_filter_prepare_image($image);
if (!$image_render_array) {
continue;
}
// Get the responsive markup for this image.
$new_markup = drupal_render($image_render_array);
// Replace the original img tag with the responsive markup.
$text = str_replace($image, $new_markup, $text);
}
}
return $text;
}