Make WordPress Core


Ignore:
Timestamp:
04/02/2019 10:12:11 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Widgets: Make sure changes to media widgets' instance schema via widget_{$this->id_base}_instance_schema filter are not overridden by subclasses.

Previously, WP_Widget_Media_Audio, WP_Widget_Media_Image, and WP_Widget_Media_Video used to override the changes due to reversed arguments in array_merge() call.

Props Toro_Unit, birgire.
Fixes #45029.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-media-image.php

    r44767 r45100  
    2020     * Constructor.
    2121     *
    22      * @since  4.8.0
     22     * @since 4.8.0
    2323     */
    2424    public function __construct() {
     
    5454     * Get schema for properties of a widget instance (item).
    5555     *
    56      * @since  4.8.0
     56     * @since 4.8.0
    5757     *
    5858     * @see WP_REST_Controller::get_item_schema()
     
    6363    public function get_instance_schema() {
    6464        return array_merge(
    65             parent::get_instance_schema(),
    6665            array(
    6766                'size'              => array(
     
    162161                 * - width (redundant when size is not custom)
    163162                 */
    164             )
     163            ),
     164            parent::get_instance_schema()
    165165        );
    166166    }
     
    169169     * Render the media on the frontend.
    170170     *
    171      * @since  4.8.0
     171     * @since 4.8.0
    172172     *
    173173     * @param array $instance Widget instance props.
Note: See TracChangeset for help on using the changeset viewer.