WP_Customize_Setting::aggregate_multidimensional()protectedWP 4.4.0

Set up the setting for aggregated multidimensional values.

When a multidimensional setting gets aggregated, all of its preview and update calls get combined into one call, greatly improving performance.

Метод класса: WP_Customize_Setting{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->aggregate_multidimensional();

Список изменений

С версии 4.4.0 Введена.

Код WP_Customize_Setting::aggregate_multidimensional() WP 6.4.3

protected function aggregate_multidimensional() {
	$id_base = $this->id_data['base'];
	if ( ! isset( self::$aggregated_multidimensionals[ $this->type ] ) ) {
		self::$aggregated_multidimensionals[ $this->type ] = array();
	}
	if ( ! isset( self::$aggregated_multidimensionals[ $this->type ][ $id_base ] ) ) {
		self::$aggregated_multidimensionals[ $this->type ][ $id_base ] = array(
			'previewed_instances'       => array(), // Calling preview() will add the $setting to the array.
			'preview_applied_instances' => array(), // Flags for which settings have had their values applied.
			'root_value'                => $this->get_root_value( array() ), // Root value for initial state, manipulated by preview and update calls.
		);
	}

	if ( ! empty( $this->id_data['keys'] ) ) {
		// Note the preview-applied flag is cleared at priority 9 to ensure it is cleared before a deferred-preview runs.
		add_action( "customize_post_value_set_{$this->id}", array( $this, '_clear_aggregated_multidimensional_preview_applied_flag' ), 9 );
		$this->is_multidimensional_aggregated = true;
	}
}