WordPress.org

Make WordPress Core

Changeset 47249


Ignore:
Timestamp:
02/10/2020 10:01:49 PM (11 months ago)
Author:
SergeyBiryukov
Message:

Docs: Improve documentation for the $attr parameter of wp_get_attachment_image().

Props juanfra, Mte90, DrewAPicture, joemcgill, SergeyBiryukov.
Fixes #36661.

File:
1 edited

Legend:

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

    r47219 r47249  
    364364 *
    365365 * @param int          $id    Attachment ID.
    366  * @param string       $alt   Image Description for the alt attribute.
    367  * @param string       $title Image Description for the title attribute.
     366 * @param string       $alt   Image description for the alt attribute.
     367 * @param string       $title Image description for the title attribute.
    368368 * @param string       $align Part of the class name for aligning the image.
    369369 * @param string|array $size  Optional. Registered image size to retrieve a tag for. Accepts any
     
    403403     * @param string       $html  HTML content for the image.
    404404     * @param int          $id    Attachment ID.
    405      * @param string       $alt   Alternate text.
    406      * @param string       $title Attachment title.
     405     * @param string       $alt   Image description for the alt attribute.
     406     * @param string       $title Image description for the title attribute.
    407407     * @param string       $align Part of the class name for aligning the image.
    408408     * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
     
    10001000 *                                    and height values in pixels (in that order). Default 'thumbnail'.
    10011001 * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
    1002  * @param string|array $attr          Optional. Attributes for the image markup. Default empty.
     1002 * @param string|array $attr {
     1003 *     Optional. Attributes for the image markup.
     1004 *
     1005 *     @type string $src    Image attachment URL.
     1006 *     @type string $class  CSS class name or space-separated list of classes.
     1007 *                          Default `attachment-$size_class size-$size_class`,
     1008 *                          where `$size_class` is the image size being requested.
     1009 *     @type string $alt    Image description for the alt attribute.
     1010 *     @type string $srcset The 'srcset' attribute value.
     1011 *     @type string $sizes  The 'sizes' attribute value.
     1012 * }
    10031013 * @return string HTML img element or empty string on failure.
    10041014 */
     
    10071017    $image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
    10081018    if ( $image ) {
    1009         list($src, $width, $height) = $image;
    1010         $hwstring                   = image_hwstring( $width, $height );
    1011         $size_class                 = $size;
     1019        list( $src, $width, $height ) = $image;
     1020        $hwstring                     = image_hwstring( $width, $height );
     1021        $size_class                   = $size;
    10121022        if ( is_array( $size_class ) ) {
    10131023            $size_class = join( 'x', $size_class );
     
    10471057         *
    10481058         * @param string[]     $attr       Array of attribute values for the image markup, keyed by attribute name.
     1059         *                                 See wp_get_attachment_image().
    10491060         * @param WP_Post      $attachment Image attachment post.
    10501061         * @param string|array $size       Requested size. Image size or array of width and height values
Note: See TracChangeset for help on using the changeset viewer.