acf_form_front::validate_form()publicACF 5.5.8

validate_form

description

@type    function

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

Хуки из метода

Возвращает

$post_id. (int)

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

$acf_form_front = new acf_form_front();
$acf_form_front->validate_form( $args );
$args (обязательный)
-

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

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

Код acf_form_front::validate_form() ACF 5.10.2

function validate_form( $args ) {

	// defaults
	// Todo: Allow message and button text to be generated by CPT settings.
	$args = wp_parse_args(
		$args,
		array(
			'id'                    => 'acf-form',
			'post_id'               => false,
			'new_post'              => false,
			'field_groups'          => false,
			'fields'                => false,
			'post_title'            => false,
			'post_content'          => false,
			'form'                  => true,
			'form_attributes'       => array(),
			'return'                => add_query_arg( 'updated', 'true', acf_get_current_url() ),
			'html_before_fields'    => '',
			'html_after_fields'     => '',
			'submit_value'          => __( 'Update', 'acf' ),
			'updated_message'       => __( 'Post updated', 'acf' ),
			'label_placement'       => 'top',
			'instruction_placement' => 'label',
			'field_el'              => 'div',
			'uploader'              => 'wp',
			'honeypot'              => true,
			'html_updated_message'  => '<div id="message" class="updated"><p>%s</p></div>', // 5.5.10
			'html_submit_button'    => '<input type="submit" class="acf-button button button-primary button-large" value="%s" />', // 5.5.10
			'html_submit_spinner'   => '<span class="acf-spinner"></span>', // 5.5.10
			'kses'                  => true, // 5.6.5
		)
	);

	$args['form_attributes'] = wp_parse_args(
		$args['form_attributes'],
		array(
			'id'     => $args['id'],
			'class'  => 'acf-form',
			'action' => '',
			'method' => 'post',
		)
	);

	// filter post_id
	$args['post_id'] = acf_get_valid_post_id( $args['post_id'] );

	// new post?
	if ( $args['post_id'] === 'new_post' ) {

		$args['new_post'] = wp_parse_args(
			$args['new_post'],
			array(
				'post_type'   => 'post',
				'post_status' => 'draft',
			)
		);

	}

	// filter
	$args = apply_filters( 'acf/validate_form', $args );

	// return
	return $args;

}