wpcf7_tag_generator_file

The Contact Form 7 wpcf7 tag generator file function.

Description

wpcf7_tag_generator_file( $contact_form, (string) $args = '' ); 

Parameters (2)

0. $contact_form
The contact form.
1. $args — Optional. (string) => ''
The args.

Usage

  1. if ( !function_exists( 'wpcf7_tag_generator_file' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/file.php'; 
  3.  
  4. // The contact form. 
  5. $contact_form = null; 
  6.  
  7. // The args. 
  8. $args = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wpcf7_tag_generator_file($contact_form, $args); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/file.php  
  1. function wpcf7_tag_generator_file( $contact_form, $args = '' ) { 
  2. $args = wp_parse_args( $args, array() ); 
  3. $type = 'file'; 
  4.  
  5. $description = __( "Generate a form-tag for a file uploading field. For more details, see %s.", 'contact-form-7' ); 
  6.  
  7. $desc_link = wpcf7_link( __( 'https://contactform7.com/file-uploading-and-attachment/', 'contact-form-7' ), __( 'File Uploading and Attachment', 'contact-form-7' ) ); 
  8.  
  9. ?> 
  10. <div class="control-box"> 
  11. <fieldset> 
  12. <legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend> 
  13.  
  14. <table class="form-table"> 
  15. <tbody> 
  16. <tr> 
  17. <th scope="row"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></th> 
  18. <td> 
  19. <fieldset> 
  20. <legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend> 
  21. <label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label> 
  22. </fieldset> 
  23. </td> 
  24. </tr> 
  25.  
  26. <tr> 
  27. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th> 
  28. <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td> 
  29. </tr> 
  30.  
  31. <tr> 
  32. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-limit' ); ?>"><?php echo esc_html( __( "File size limit (bytes)", 'contact-form-7' ) ); ?></label></th> 
  33. <td><input type="text" name="limit" class="filesize oneline option" id="<?php echo esc_attr( $args['content'] . '-limit' ); ?>" /></td> 
  34. </tr> 
  35.  
  36. <tr> 
  37. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-filetypes' ); ?>"><?php echo esc_html( __( 'Acceptable file types', 'contact-form-7' ) ); ?></label></th> 
  38. <td><input type="text" name="filetypes" class="filetype oneline option" id="<?php echo esc_attr( $args['content'] . '-filetypes' ); ?>" /></td> 
  39. </tr> 
  40.  
  41. <tr> 
  42. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th> 
  43. <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td> 
  44. </tr> 
  45.  
  46. <tr> 
  47. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th> 
  48. <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td> 
  49. </tr> 
  50.  
  51. </tbody> 
  52. </table> 
  53. </fieldset> 
  54. </div> 
  55.  
  56. <div class="insert-box"> 
  57. <input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" /> 
  58.  
  59. <div class="submitbox"> 
  60. <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" /> 
  61. </div> 
  62.  
  63. <br class="clear" /> 
  64.  
  65. <p class="description mail-tag"><label for="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>"><?php echo sprintf( esc_html( __( "To attach the file uploaded through this field to mail, you need to insert the corresponding mail-tag (%s) into the File Attachments field on the Mail tab.", 'contact-form-7' ) ), '<strong><span class="mail-tag"></span></strong>' ); ?><input type="text" class="mail-tag code hidden" readonly="readonly" id="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>" /></label></p> 
  66. </div> 
  67. <?php