Make WordPress Core


Ignore:
Timestamp:
10/19/2017 11:43:22 PM (9 years ago)
Author:
westonruter
Message:

Widgets: Improve extensibility of the Gallery widget and of media widgets generally.

  • Introduce a widget_{$id_base}_instance_schema filter for plugins to add new properties to a media widget's instance schema.
  • Pass all of a gallery widget's instance props to the gallery media frame, not just the ones that core supports.

See #32417, #41914.
Fixes #42285.

File:
1 edited

Legend:

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

    r41866 r41951  
    128128         */
    129129        public function get_instance_schema() {
    130                 return array(
     130                $schema = array(
    131131                        'attachment_id' => array(
    132132                                'type' => 'integer',
    … …  
    150150                        ),
    151151                );
     152
     153                /**
     154                 * Filters the media widget instance schema to add additional properties.
     155                 *
     156                 * @since 4.9.0
     157                 *
     158                 * @param array           $schema Instance schema.
     159                 * @param WP_Widget_Media $this   Widget object.
     160                 */
     161                $schema = apply_filters( "widget_{$this->id_base}_instance_schema", $schema, $this );
     162
     163                return $schema;
    152164        }
    153165
Note: See TracChangeset for help on using the changeset viewer.