wpcf7_tag_generator_file()CF7 1.0

Хуков нет.

Возвращает

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

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

wpcf7_tag_generator_file( $contact_form, $options );
$contact_form(обязательный)
.
$options(обязательный)
.

Код wpcf7_tag_generator_file() CF7 6.0.6

<?php
function wpcf7_tag_generator_file( $contact_form, $options ) {
	$field_types = array(
		'file' => array(
			'display_name' => __( 'File uploading field', 'contact-form-7' ),
			'heading' => __( 'File uploading field form-tag generator', 'contact-form-7' ),
			'description' => __( 'Generates a form-tag for a <a href="https://contactform7.com/file-uploading-and-attachment/">file uploading field</a>.', 'contact-form-7' ),
		),
	);

	$tgg = new WPCF7_TagGeneratorGenerator( $options['content'] );

?>
<header class="description-box">
	<h3><?php
		echo esc_html( $field_types['file']['heading'] );
	?></h3>

	<p><?php
		$description = wp_kses(
			$field_types['file']['description'],
			array(
				'a' => array( 'href' => true ),
				'strong' => array(),
			),
			array( 'http', 'https' )
		);

		echo $description;
	?></p>
</header>

<div class="control-box">
	<?php
		$tgg->print( 'field_type', array(
			'with_required' => true,
			'select_options' => array(
				'file' => $field_types['file']['display_name'],
			),
		) );

		$tgg->print( 'field_name' );

		$tgg->print( 'class_attr' );
	?>

	<fieldset>
		<legend id="<?php echo esc_attr( $tgg->ref( 'filetypes-option-legend' ) ); ?>"><?php
			echo esc_html( __( 'Acceptable file types', 'contact-form-7' ) );
		?></legend>
		<label><?php
		echo sprintf(
			'<span %1$s>%2$s</span><br />',
			wpcf7_format_atts( array(
				'id' => $tgg->ref( 'filetypes-option-description' ),
			) ),
			esc_html( __( "Pipe-separated file types list. You can use file extensions and MIME types.", 'contact-form-7' ) )
		);

		echo sprintf(
			'<input %s />',
			wpcf7_format_atts( array(
				'type' => 'text',
				'pattern' => '[0-9a-z*\/\|]*',
				'value' => 'audio/*|video/*|image/*',
				'aria-labelledby' => $tgg->ref( 'filetypes-option-legend' ),
				'aria-describedby' => $tgg->ref( 'filetypes-option-description' ),
				'data-tag-part' => 'option',
				'data-tag-option' => 'filetypes:',
			) )
		);
		?></label>
	</fieldset>

	<fieldset>
		<legend id="<?php echo esc_attr( $tgg->ref( 'limit-option-legend' ) ); ?>"><?php
			echo esc_html( __( 'File size limit', 'contact-form-7' ) );
		?></legend>
		<label><?php
		echo sprintf(
			'<span %1$s>%2$s</span><br />',
			wpcf7_format_atts( array(
				'id' => $tgg->ref( 'limit-option-description' ),
			) ),
			esc_html( __( "In bytes. You can use kb and mb suffixes.", 'contact-form-7' ) )
		);

		echo sprintf(
			'<input %s />',
			wpcf7_format_atts( array(
				'type' => 'text',
				'pattern' => '[1-9][0-9]*([kKmM]?[bB])?',
				'value' => '1mb',
				'aria-labelledby' => $tgg->ref( 'limit-option-legend' ),
				'aria-describedby' => $tgg->ref( 'limit-option-description' ),
				'data-tag-part' => 'option',
				'data-tag-option' => 'limit:',
			) )
		);
		?></label>
	</fieldset>
</div>

<footer class="insert-box">
	<?php
		$tgg->print( 'insert_box_content' );

		$tgg->print( 'mail_tag_tip' );
	?>
</footer>
<?php
}