Make WordPress Core

Ticket #34612: 34612.filter.diff

File 34612.filter.diff, 2.3 KB (added by joemcgill, 10 years ago)

Update params for wp_calculate_image_srcset filter.

  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index 043657d..77fb1dc 100644
    function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac 
    10741074         *
    10751075         * @since 4.4.0
    10761076         *
    1077          * @param array $sources       An array of sources to include in the 'srcset'. Each source
    1078          *                             consists of an array containing the URL and the descriptor
    1079          *                             type and value (default: the image width):
     1077         * @param array  $sources       An array of sources to include in the 'srcset'. Each source
     1078         *                              consists of an array containing the URL and the descriptor
     1079         *                              type and value (default: the image width):
    10801080         *
    1081          *                             image width => array(
    1082          *                                 'url'        => string,
    1083          *                                 'descriptor' => string ('w' or 'x'),
    1084          *                                 'value'      => integer (width or pixel density)
    1085          *                             },
     1081         *                              image width => array(
     1082         *                                  'url'        => string,
     1083         *                                  'descriptor' => string ('w' or 'x'),
     1084         *                                  'value'      => integer (width or pixel density)
     1085         *                              },
    10861086         *
    1087          * @param int   $attachment_id Image attachment ID.
    1088          * @param array $size_array    Array of width and height values in pixels (in that order).
    1089          * @param array $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
     1087         * @param array  $size_array    Array of width and height values in pixels (in that order).
     1088         * @param string $image_src     The 'src' of the image.
     1089         * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
     1090         * @param int    $attachment_id Image attachment ID.
    10901091
    10911092         */
    1092         $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $attachment_id, $size_array, $image_meta );
     1093        $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );
    10931094
    10941095        // Only return a 'srcset' value if there is more than one source.
    10951096        if ( count( $sources ) < 2 ) {