WP_Widget_Media_Audio::get_instance_schema() WordPress Method

The WP_Widget_Media_Audio::get_instance_schema() method is used to return the schema for the audio widget. This is used to create the form for the widget in the admin area. The schema includes the following fields: title, artist, album, caption, loop, and autoplay.

WP_Widget_Media_Audio::get_instance_schema() #

Get schema for properties of a widget instance (item).


Description

Top ↑

See also


Top ↑

Return

(array) Schema for properties.


Top ↑

Source

File: wp-includes/widgets/class-wp-widget-media-audio.php

	public function get_instance_schema() {
		$schema = array(
			'preload' => array(
				'type'        => 'string',
				'enum'        => array( 'none', 'auto', 'metadata' ),
				'default'     => 'none',
				'description' => __( 'Preload' ),
			),
			'loop'    => array(
				'type'        => 'boolean',
				'default'     => false,
				'description' => __( 'Loop' ),
			),
		);

		foreach ( wp_get_audio_extensions() as $audio_extension ) {
			$schema[ $audio_extension ] = array(
				'type'        => 'string',
				'default'     => '',
				'format'      => 'uri',
				/* translators: %s: Audio extension. */
				'description' => sprintf( __( 'URL to the %s audio source file' ), $audio_extension ),
			);
		}

		return array_merge( $schema, parent::get_instance_schema() );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.