wppaste
WordPress

WP_Widget_Media_Image::get_instance_schema(): array

Since
4.8.0
Source
wp-includes/widgets/class-wp-widget-media-image.php:65
Get schema for properties of a widget instance (item).

Return

array
Schema for properties.

Uses · 3

Used by · 2

Source

	public function get_instance_schema() {		return array_merge(			array(				'size'              => array(					'type'        => 'string',					'enum'        => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ),					'default'     => 'medium',					'description' => __( 'Size' ),				),				'width'             => array( // Via 'customWidth', only when size=custom; otherwise via 'width'.					'type'        => 'integer',					'minimum'     => 0,					'default'     => 0,					'description' => __( 'Width' ),				),				'height'            => array( // Via 'customHeight', only when size=custom; otherwise via 'height'.					'type'        => 'integer',					'minimum'     => 0,					'default'     => 0,					'description' => __( 'Height' ),				), 				'caption'           => array(					'type'                  => 'string',					'default'               => '',					'sanitize_callback'     => 'wp_kses_post',					'description'           => __( 'Caption' ),					'should_preview_update' => false,				),				'alt'               => array(					'type'              => 'string',					'default'           => '',					'sanitize_callback' => 'sanitize_text_field',					'description'       => __( 'Alternative Text' ),				),				'link_type'         => array(					'type'                  => 'string',					'enum'                  => array( 'none', 'file', 'post', 'custom' ),					'default'               => 'custom',					'media_prop'            => 'link',					'description'           => __( 'Link To' ),					'should_preview_update' => true,				),				'link_url'          => array(					'type'                  => 'string',					'default'               => '',					'format'                => 'uri',					'media_prop'            => 'linkUrl',					'description'           => __( 'URL' ),					'should_preview_update' => true,				),				'image_classes'     => array(					'type'                  => 'string',					'default'               => '',					'sanitize_callback'     => array( $this, 'sanitize_token_list' ),					'media_prop'            => 'extraClasses',					'description'           => __( 'Image CSS Class' ),					'should_preview_update' => false,				),				'link_classes'      => array(					'type'                  => 'string',					'default'               => '',					'sanitize_callback'     => array( $this, 'sanitize_token_list' ),					'media_prop'            => 'linkClassName',					'should_preview_update' => false,					'description'           => __( 'Link CSS Class' ),				),				'link_rel'          => array(					'type'                  => 'string',					'default'               => '',					'sanitize_callback'     => array( $this, 'sanitize_token_list' ),					'media_prop'            => 'linkRel',					'description'           => __( 'Link Rel' ),					'should_preview_update' => false,				),				'link_target_blank' => array(					'type'                  => 'boolean',					'default'               => false,					'media_prop'            => 'linkTargetBlank',					'description'           => __( 'Open link in a new tab' ),

History

Introduced in 4.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/widgets/class-wp-widget-media-image.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.