acf_form_customizer::customize_preview_init()publicACF 5.3.2

customize_preview_init

This function is called when customizer preview is initialized

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

Хуков нет.

Возвращает

null. Ничего (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 6.0.4

function customize_preview_init( $customizer ) {

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

	// bail early 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 early 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 );

}