From 7d0aa3a54a3ff4d88811c5705fdaf82d64a44792 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 9 Nov 2015 23:30:26 +0000 Subject: [PATCH] Responsive images: properly arrange the parameters for the `wp_calculate_image_srcset` filter and add fix the inline documentation. Props joemcgill. Fixes #34612. Built from https://develop.svn.wordpress.org/trunk@35591 git-svn-id: http://core.svn.wordpress.org/trunk@35555 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 27 ++++++++++++++------------- wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 043657d33e..7892f93ef9 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1074,22 +1074,23 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac * * @since 4.4.0 * - * @param array $sources An array of sources to include in the 'srcset'. Each source - * consists of an array containing the URL and the descriptor - * type and value (default: the image width): + * @param array $sources { + * An array of sources to include in the 'srcset'. * - * image width => array( - * 'url' => string, - * 'descriptor' => string ('w' or 'x'), - * 'value' => integer (width or pixel density) - * }, - * - * @param int $attachment_id Image attachment ID. - * @param array $size_array Array of width and height values in pixels (in that order). - * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. + * @type type array $width { + * @type type string $url The URL of an image source in the . + * @type type string $descriptor The descriptor type used in the image candidate string, either 'w' or 'x'. + * @type type int $value The source width, if paired with a 'w' descriptor or a pixel density value + * if paired with an 'x' descriptor. + * } + * } + * @param array $size_array Array of width and height values in pixels (in that order). + * @param string $image_src The 'src' of the image. + * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. + * @param int $attachment_id Image attachment ID. */ - $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $attachment_id, $size_array, $image_meta ); + $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id ); // Only return a 'srcset' value if there is more than one source. if ( count( $sources ) < 2 ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 39aae16024..899f485247 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-beta3-35590'; +$wp_version = '4.4-beta3-35591'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.