Make WordPress Core


Ignore:
Timestamp:
07/06/2023 04:31:02 PM (21 months ago)
Author:
flixos90
Message:

Media: Ensure that the image widget supports loading optimization attributes.

This changeset adds support for loading optimization attributes such as loading="lazy" and fetchpriority="high" to the image widget. A new context widget_media_image is introduced for that purpose.

Props spacedmonkey, thekt12, mukesh27, westonruter.
Fixes #58704.
See #58235.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r56143 r56154  
    41924192     * @expectedDeprecated wp_get_loading_attr_default
    41934193     *
    4194      * @dataProvider data_special_contexts_for_the_content
     4194     * @dataProvider data_special_contexts_for_the_content_wp_get_loading_attr_default
    41954195     *
    41964196     * @param string $context Context for the element for which the `loading` attribute value is requested.
     
    42094209     * @expectedDeprecated wp_get_loading_attr_default
    42104210     *
    4211      * @dataProvider data_special_contexts_for_the_content
     4211     * @dataProvider data_special_contexts_for_the_content_wp_get_loading_attr_default
    42124212     *
    42134213     * @param string $context Context for the element for which the `loading` attribute value is requested.
     
    42344234     */
    42354235    public function data_special_contexts_for_the_content() {
     4236        return array(
     4237            'widget_media_image'      => array( 'context' => 'widget_media_image' ),
     4238            'the_post_thumbnail'      => array( 'context' => 'the_post_thumbnail' ),
     4239            'wp_get_attachment_image' => array( 'context' => 'wp_get_attachment_image' ),
     4240        );
     4241    }
     4242
     4243    /**
     4244     * Data provider.
     4245     *
     4246     * @return array[]
     4247     */
     4248    public function data_special_contexts_for_the_content_wp_get_loading_attr_default() {
    42364249        return array(
    42374250            'the_post_thumbnail'      => array( 'context' => 'the_post_thumbnail' ),
Note: See TracChangeset for help on using the changeset viewer.