WPCF7_ContactForm::form_hidden_fields()privateCF7 1.0

Returns a set of hidden fields.

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

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

Возвращает

null. Ничего.

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

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

Код WPCF7_ContactForm::form_hidden_fields() CF7 5.6.4

private function form_hidden_fields() {
	$hidden_fields = array(
		'_wpcf7' => $this->id(),
		'_wpcf7_version' => WPCF7_VERSION,
		'_wpcf7_locale' => $this->locale(),
		'_wpcf7_unit_tag' => $this->unit_tag(),
		'_wpcf7_container_post' => 0,
		'_wpcf7_posted_data_hash' => '',
	);

	if ( in_the_loop() ) {
		$hidden_fields['_wpcf7_container_post'] = (int) get_the_ID();
	}

	if ( $this->nonce_is_active() and is_user_logged_in() ) {
		$hidden_fields['_wpnonce'] = wpcf7_create_nonce();
	}

	$hidden_fields += (array) apply_filters(
		'wpcf7_form_hidden_fields', array()
	);

	$content = '';

	foreach ( $hidden_fields as $name => $value ) {
		$content .= sprintf(
			'<input type="hidden" name="%1$s" value="%2$s" />',
			esc_attr( $name ),
			esc_attr( $value )
		) . "\n";
	}

	return '<div style="display: none;">' . "\n" . $content . '</div>' . "\n";
}