acf_form_customizer::customize_preview_init()publicACF 5.3.2

customize_preview_init

This function is called when customizer preview is initialized

@type    function

{} Это метод класса: acf_form_customizer{}

Хуков нет.

Возвращает

null. Ничего.

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

$acf_form_customizer = new acf_form_customizer();
$acf_form_customizer->customize_preview_init( $customizer );
$customizer (обязательный)
-

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

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

Код acf_form_customizer::customize_preview_init() ACF 5.10.2

function customize_preview_init( $customizer ) {

	// get customizer settings (widgets)
	$settings = $this->settings( $customizer );

	// bail ealry if no settings
	if ( empty( $settings ) ) {
		return;
	}

	// append values
	foreach ( $settings as $setting ) {

		// get acf data
		$data = $setting->acf;

		// append acf_value to preview_values
		$this->preview_values[ $data['post_id'] ] = $data['values'];
		$this->preview_fields[ $data['post_id'] ] = $data['fields'];

	}

	// bail ealry if no preview_values
	if ( empty( $this->preview_values ) ) {
		return;
	}

	// add filters
	add_filter( 'acf/pre_load_value', array( $this, 'pre_load_value' ), 10, 3 );
	add_filter( 'acf/pre_load_reference', array( $this, 'pre_load_reference' ), 10, 3 );

}