Make WordPress Core


Ignore:
Timestamp:
08/24/2020 10:02:44 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Add documentation and a @since note about the loading attribute added to wp_get_attachment_image().

Follow-up to [48272].

Props audrasjb.
Fixes #51122.

File:
1 edited

Legend:

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

    r48798 r48852  
    10031003 *
    10041004 * @since 2.5.0
     1005 * @since 5.5.0 The `$loading` attribute was added.
    10051006 *
    10061007 * @param int          $attachment_id Image attachment ID.
     
    10111012 *     Optional. Attributes for the image markup.
    10121013 *
    1013  *     @type string $src    Image attachment URL.
    1014  *     @type string $class  CSS class name or space-separated list of classes.
    1015  *                          Default `attachment-$size_class size-$size_class`,
    1016  *                          where `$size_class` is the image size being requested.
    1017  *     @type string $alt    Image description for the alt attribute.
    1018  *     @type string $srcset The 'srcset' attribute value.
    1019  *     @type string $sizes  The 'sizes' attribute value.
     1014 *     @type string       $src     Image attachment URL.
     1015 *     @type string       $class   CSS class name or space-separated list of classes.
     1016 *                                 Default `attachment-$size_class size-$size_class`,
     1017 *                                 where `$size_class` is the image size being requested.
     1018 *     @type string       $alt     Image description for the alt attribute.
     1019 *     @type string       $srcset  The 'srcset' attribute value.
     1020 *     @type string       $sizes   The 'sizes' attribute value.
     1021 *     @type string|false $loading The 'loading' attribute value. Passing a value of false
     1022 *                                 will result in the attribute being omitted for the image.
     1023 *                                 Defaults to 'lazy', depending on wp_lazy_loading_enabled().
    10201024 * }
    10211025 * @return string HTML img element or empty string on failure.
     
    10491053        $attr = wp_parse_args( $attr, $default_attr );
    10501054
    1051         // If `loading` attribute default of `lazy` is overridden for this
    1052         // image to omit the attribute, ensure it is not included.
     1055        // If the default value of `lazy` for the `loading` attribute is overridden
     1056        // to omit the attribute for this image, ensure it is not included.
    10531057        if ( array_key_exists( 'loading', $attr ) && ! $attr['loading'] ) {
    10541058            unset( $attr['loading'] );
Note: See TracChangeset for help on using the changeset viewer.