WP_Customize_Partial::__construct

Advertisement

Summery Summery

Constructor.

Syntax Syntax

WP_Customize_Partial::__construct( WP_Customize_Selective_Refresh $component, string $id, array $args = array() )

Description Description

Supplied $args override class property defaults.

If $args['settings'] is not defined, use the $id as the setting ID.

Parameters Parameters

$component

(Required) Customize Partial Refresh plugin instance.

$id

(Required) Control ID.

$args

(Optional) Arguments to override class property defaults.

  • 'settings'
    (array|string) All settings IDs tied to the partial. If undefined, $id will be used.

Default value: array()

Source Source

File: wp-includes/customize/class-wp-customize-partial.php

	 *                                           a partial's placement.
	 *     @type string[] $settings              IDs for settings tied to the partial. If undefined, `$id` will be used.
	 *     @type string   $primary_setting       The ID for the setting that this partial is primarily responsible for
	 *                                           rendering. If not supplied, it will default to the ID of the first setting.
	 *     @type string   $capability            Capability required to edit this partial.
	 *                                           Normally this is empty and the capability is derived from the capabilities
	 *                                           of the associated `$settings`.
	 *     @type callable $render_callback       Render callback.
	 *                                           Callback is called with one argument, the instance of WP_Customize_Partial.
	 *                                           The callback can either echo the partial or return the partial as a string,
	 *                                           or return false if error.
	 *     @type bool     $container_inclusive   Whether the container element is included in the partial, or if only
	 *                                           the contents are rendered.
	 *     @type bool     $fallback_refresh      Whether to refresh the entire preview in case a partial cannot be refreshed.
	 *                                           A partial render is considered a failure if the render_callback returns
	 *                                           false.
	 * }
	 */
	public function __construct( WP_Customize_Selective_Refresh $component, $id, $args = array() ) {
		$keys = array_keys( get_object_vars( $this ) );
		foreach ( $keys as $key ) {
			if ( isset( $args[ $key ] ) ) {
				$this->$key = $args[ $key ];
			}
		}

		$this->component       = $component;
		$this->id              = $id;

Advertisement

Changelog Changelog

Changelog
Version Description
4.5.0 Introduced.

Advertisement

Leave a Reply