wpcf7_tag_generator_file() │ CF7 1.0
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wpcf7_tag_generator_file( $contact_form, $options );
- $contact_form(обязательный)
- .
- $options(обязательный)
- .
Код wpcf7_tag_generator_file() wpcf7 tag generator file CF7 6.2.5
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' => sprintf(
/* translators: %s: URL to file uploading field doc */
__( 'Generates a form-tag for a <a href="%s">file uploading field</a>.', 'contact-form-7' ),
'https://contactform7.com/file-uploading-and-attachment/'
),
),
);
$tgg = new WPCF7_TagGeneratorGenerator( $options['content'] );
$formatter = new WPCF7_HTMLFormatter();
$formatter->append_start_tag( 'header', array(
'class' => 'description-box',
) );
$formatter->append_start_tag( 'h3' );
$formatter->append_preformatted(
esc_html( $field_types['file']['heading'] )
);
$formatter->end_tag( 'h3' );
$formatter->append_start_tag( 'p' );
$formatter->append_preformatted(
wp_kses_data( $field_types['file']['description'] )
);
$formatter->end_tag( 'header' );
$formatter->append_start_tag( 'div', array(
'class' => 'control-box',
) );
$formatter->call_user_func( static function () use ( $tgg, $field_types ) {
$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' );
} );
$formatter->append_start_tag( 'fieldset' );
$formatter->append_start_tag( 'legend', array(
'id' => $tgg->ref( 'filetypes-option-legend' ),
) );
$formatter->append_preformatted(
esc_html( __( 'Acceptable file types', 'contact-form-7' ) )
);
$formatter->end_tag( 'legend' );
$formatter->append_start_tag( 'label' );
$formatter->append_start_tag( 'span', array(
'id' => $tgg->ref( 'filetypes-option-description' ),
) );
$formatter->append_preformatted(
esc_html( __( 'Pipe-separated file types list. You can use file extensions and MIME types.', 'contact-form-7' ) )
);
$formatter->end_tag( 'span' );
$formatter->append_start_tag( 'br' );
$formatter->append_start_tag( 'input', 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:',
) );
$formatter->end_tag( 'fieldset' );
$formatter->append_start_tag( 'fieldset' );
$formatter->append_start_tag( 'legend', array(
'id' => $tgg->ref( 'limit-option-legend' ),
) );
$formatter->append_preformatted(
esc_html( __( 'File size limit', 'contact-form-7' ) )
);
$formatter->end_tag( 'legend' );
$formatter->append_start_tag( 'label' );
$formatter->append_start_tag( 'span', array(
'id' => $tgg->ref( 'limit-option-description' ),
) );
$formatter->append_preformatted(
esc_html( __( 'In bytes. You can use kb and mb suffixes.', 'contact-form-7' ) )
);
$formatter->end_tag( 'span' );
$formatter->append_start_tag( 'br' );
$formatter->append_start_tag( 'input', 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:',
) );
$formatter->end_tag( 'fieldset' );
$formatter->end_tag( 'div' );
$formatter->append_start_tag( 'footer', array(
'class' => 'insert-box',
) );
$formatter->call_user_func( static function () use ( $tgg, $field_types ) {
$tgg->print( 'insert_box_content' );
$tgg->print( 'mail_tag_tip' );
} );
$formatter->print();
}