WP_Widget_Media::__construct( string $id_base, string $name, array $widget_options = array(), array $control_options = array() )

In this article

Constructor.

Parameters

$id_basestringrequired
Base ID for the widget, lowercase and unique.
$namestringrequired
Name for the widget displayed on the configuration page.
$widget_optionsarrayoptional
Widget options. See wp_register_sidebar_widget() for information on accepted arguments.

Default:array()

$control_optionsarrayoptional
Widget control options. See wp_register_widget_control() for information on accepted arguments.

Default:array()

Source

public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) {
	$widget_opts = wp_parse_args(
		$widget_options,
		array(
			'description'                 => self::get_default_description(),
			'customize_selective_refresh' => true,
			'show_instance_in_rest'       => true,
			'mime_type'                   => '',
		)
	);

	$control_opts = wp_parse_args( $control_options, array() );

	$this->l10n = array_merge( self::get_l10n_defaults(), array_filter( $this->l10n ) );

	parent::__construct(
		$id_base,
		$name,
		$widget_opts,
		$control_opts
	);
}

Changelog

VersionDescription
4.8.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.