Make WordPress Core

Changeset 35672


Ignore:
Timestamp:
11/18/2015 06:52:15 PM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Properly mark optional parameters as such in the DocBlock and function signature for wp_calculate_image_sizes().

Also updates the subsequent hook docs for the wp_calculate_image_sizes filter.

Props joemcgill.
Fixes #34612.

File:
1 edited

Legend:

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

    r35601 r35672  
    11371137
    11381138/**
    1139  * Create 'sizes' attribute value for an image.
     1139 * Creates a 'sizes' attribute value for an image.
    11401140 *
    11411141 * @since 4.4.0
     
    11431143 * @param array|string $size          Image size to retrieve. Accepts any valid image size, or an array
    11441144 *                                    of width and height values in pixels (in that order). Default 'medium'.
     1145 * @param string       $image_src     Optional. The URL to the image file. Default null.
    11451146 * @param array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
    1146  * @param int          $attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id` is needed
    1147  *                                    when using the image size name as argument for `$size`.
    1148  * @param string       $image_src     Optional. The URL to the image file.
    1149  *
     1147 *                                    Default null.
     1148 * @param int          $attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id`
     1149 *                                    is needed when using the image size name as argument for `$size`. Default 0.
    11501150 * @return string|bool A valid source size value for use in a 'sizes' attribute or false.
    11511151 */
    1152 function wp_calculate_image_sizes( $size, $image_src, $image_meta, $attachment_id = 0 ) {
     1152function wp_calculate_image_sizes( $size, $image_src = null, $image_meta = null, $attachment_id = 0 ) {
    11531153    $width = 0;
    11541154
     
    11821182     * @param string       $sizes         A source size value for use in a 'sizes' attribute.
    11831183     * @param array|string $size          Requested size. Image size or array of width and height values
    1184      *                                    in pixels (in that order). Default 'medium'.
    1185      * @param string       $image_src     The URL to the image file.
    1186      * @param array        $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
    1187      * @param int          $attachment_id Image attachment ID of the original image.
     1184     *                                    in pixels (in that order).
     1185     * @param string|null  $image_src     The URL to the image file or null.
     1186     * @param array|null   $image_meta    The image meta data as returned by wp_get_attachment_metadata() or null.
     1187     * @param int          $attachment_id Image attachment ID of the original image or 0.
    11881188     */
    11891189    return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id );
Note: See TracChangeset for help on using the changeset viewer.