WPCF7_TagGeneratorGenerator::default_valueprivateCF7 1.0

Template method for default value field.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->default_value( $options );
$options
.
По умолчанию: ''

Код WPCF7_TagGeneratorGenerator::default_value() CF7 6.1.5

private function default_value( $options = '' ) {
	$options = wp_parse_args( $options, array(
		'type' => 'text',
		'title' => __( 'Default value', 'contact-form-7' ),
		'with_placeholder' => false,
		'use_content' => false,
	) );

	$formatter = new WPCF7_HTMLFormatter();

	$formatter->append_start_tag( 'fieldset' );

	$formatter->append_start_tag( 'legend', array(
		'id' => $this->ref( 'value-legend' ),
	) );

	$formatter->append_preformatted( esc_html( $options['title'] ) );

	$formatter->end_tag( 'legend' );

	$formatter->append_start_tag( 'input', array(
		'type' => $options['type'],
		'data-tag-part' => $options['use_content'] ? 'content' : 'value',
		'aria-labelledby' => $this->ref( 'value-legend' ),
	) );

	if ( $options['with_placeholder'] ) {
		$formatter->append_start_tag( 'br' );
		$formatter->append_start_tag( 'label' );

		$formatter->append_start_tag( 'input', array(
			'type' => 'checkbox',
			'data-tag-part' => 'option',
			'data-tag-option' => 'placeholder',
		) );

		$formatter->append_whitespace();

		$formatter->append_preformatted(
			esc_html( __( 'Use this text as the placeholder.', 'contact-form-7' ) )
		);
	}

	$formatter->print();
}