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. git-svn-id: https://develop.svn.wordpress.org/trunk@35672 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
355e768312
commit
8e44704e5f
@ -1136,20 +1136,20 @@ function wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $image
|
||||
}
|
||||
|
||||
/**
|
||||
* Create 'sizes' attribute value for an image.
|
||||
* Creates a 'sizes' attribute value for an image.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param array|string $size Image size to retrieve. Accepts any valid image size, or an array
|
||||
* of width and height values in pixels (in that order). Default 'medium'.
|
||||
* @param string $image_src Optional. The URL to the image file. Default null.
|
||||
* @param array $image_meta Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
|
||||
* @param int $attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id` is needed
|
||||
* when using the image size name as argument for `$size`.
|
||||
* @param string $image_src Optional. The URL to the image file.
|
||||
*
|
||||
* Default null.
|
||||
* @param int $attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id`
|
||||
* is needed when using the image size name as argument for `$size`. Default 0.
|
||||
* @return string|bool A valid source size value for use in a 'sizes' attribute or false.
|
||||
*/
|
||||
function wp_calculate_image_sizes( $size, $image_src, $image_meta, $attachment_id = 0 ) {
|
||||
function wp_calculate_image_sizes( $size, $image_src = null, $image_meta = null, $attachment_id = 0 ) {
|
||||
$width = 0;
|
||||
|
||||
if ( is_array( $size ) ) {
|
||||
@ -1181,10 +1181,10 @@ function wp_calculate_image_sizes( $size, $image_src, $image_meta, $attachment_i
|
||||
*
|
||||
* @param string $sizes A source size value for use in a 'sizes' attribute.
|
||||
* @param array|string $size Requested size. Image size or array of width and height values
|
||||
* in pixels (in that order). Default 'medium'.
|
||||
* @param string $image_src The URL to the image file.
|
||||
* @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
|
||||
* @param int $attachment_id Image attachment ID of the original image.
|
||||
* in pixels (in that order).
|
||||
* @param string|null $image_src The URL to the image file or null.
|
||||
* @param array|null $image_meta The image meta data as returned by wp_get_attachment_metadata() or null.
|
||||
* @param int $attachment_id Image attachment ID of the original image or 0.
|
||||
*/
|
||||
return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user