acf_form_customizer::customize_save()publicACF 5.3.2

customize_save

This function is called when customizer saves a widget. Normally, the widget_update_callback filter would be used, but the customizer disables this and runs a custom action class-customizer-settings.php will save the widget data via the function set_root_value which uses update_option

@type    function

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

Хуков нет.

Возвращает

null. Ничего.

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

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

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

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

Код acf_form_customizer::customize_save() ACF 5.10.2

function customize_save( $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;

		// save acf data
		acf_save_post( $data['post_id'], $data['values'] );

		// remove [acf] data from saved widget array
		$id_data = $setting->id_data();
		add_filter( 'pre_update_option_' . $id_data['base'], array( $this, 'pre_update_option' ), 10, 3 );

	}

}