Make WordPress Core

Changeset 35591


Ignore:
Timestamp:
11/09/2015 11:29:56 PM (10 years ago)
Author:
azaozz
Message:

Responsive images: properly arrange the parameters for the wp_calculate_image_srcset filter and add fix the inline documentation.

Props joemcgill.
Fixes #34612.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r35569 r35591  
    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):
    1080      *
    1081      *                             image width => array(
    1082      *                                 'url'        => string,
    1083      *                                 'descriptor' => string ('w' or 'x'),
    1084      *                                 'value'      => integer (width or pixel density)
    1085      *                             },
    1086      *
    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()'.
    1090 
    1091      */
    1092     $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $attachment_id, $size_array, $image_meta );
     1077     * @param array  $sources {
     1078     *     An array of sources to include in the 'srcset'.
     1079     *
     1080     *     @type type array $width {
     1081     *          @type type string $url        The URL of an image source in the .
     1082     *          @type type string $descriptor The descriptor type used in the image candidate string, either 'w' or 'x'.
     1083     *          @type type int    $value      The source width, if paired with a 'w' descriptor or a pixel density value
     1084     *                                        if paired with an 'x' descriptor.
     1085     *     }
     1086     * }
     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.
     1091
     1092     */
     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.
Note: See TracChangeset for help on using the changeset viewer.