WPCF7_TagGeneratorGenerator::field_name()privateCF7 1.0

Template method for field name field.

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

Хуков нет.

Возвращает

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

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

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

Код WPCF7_TagGeneratorGenerator::field_name() CF7 6.0.1

<?php
private function field_name( $options = '' ) {
	$options = wp_parse_args( $options, array(
		'ask_if' => '',
	) );

?>
<fieldset>
<legend id="<?php echo esc_attr( $this->ref( 'name-legend' ) ); ?>"><?php
	echo esc_html( __( 'Field name', 'contact-form-7' ) );
?></legend>
<input type="text" data-tag-part="name" pattern="[A-Za-z][A-Za-z0-9_\-]*" aria-labelledby="<?php echo esc_attr( $this->ref( 'name-legend' ) ); ?>" />

<?php
	$tag_option = $label = '';

	if ( 'author_name' === $options['ask_if'] ) {
		$tag_option = 'autocomplete:name';

		if ( wpcf7_akismet_is_available() ) {
			$tag_option .= ' akismet:author';
		}

		$label = __( "This field expects the submitter name.", 'contact-form-7' );
	} elseif ( 'author_email' === $options['ask_if'] ) {
		$tag_option = 'autocomplete:email';

		if ( wpcf7_akismet_is_available() ) {
			$tag_option .= ' akismet:author_email';
		}

		$label = __( "This field expects the submitter email.", 'contact-form-7' );
	} elseif ( 'author_url' === $options['ask_if'] ) {
		$tag_option = 'autocomplete:url';

		if ( wpcf7_akismet_is_available() ) {
			$tag_option .= ' akismet:author_url';
		}

		$label = __( "This field expects the submitter URL.", 'contact-form-7' );
	} elseif ( 'author_tel' === $options['ask_if'] ) {
		$tag_option = 'autocomplete:tel';
		$label = __( "This field expects the submitter telephone number.", 'contact-form-7' );
	}

	if ( $tag_option ) {
?>
<br />
<label>
	<input type="checkbox" data-tag-part="option" data-tag-option="<?php echo esc_attr( $tag_option ); ?>" />
	<?php echo esc_html( $label ); ?>
</label>
<?php
	}
?>
</fieldset>
<?php
}