wpcf7_tag_generator_number

The Contact Form 7 wpcf7 tag generator number function.

Description

wpcf7_tag_generator_number( $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_number' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/number.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_number($contact_form, $args); 
  12.  

Defined (1)

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

/modules/number.php  
  1. function wpcf7_tag_generator_number( $contact_form, $args = '' ) { 
  2. $args = wp_parse_args( $args, array() ); 
  3. $type = 'number'; 
  4.  
  5. $description = __( "Generate a form-tag for a field for numeric value input. For more details, see %s.", 'contact-form-7' ); 
  6.  
  7. $desc_link = wpcf7_link( __( 'https://contactform7.com/number-fields/', 'contact-form-7' ), __( 'Number Fields', '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. <select name="tagtype"> 
  22. <option value="number" selected="selected"><?php echo esc_html( __( 'Spinbox', 'contact-form-7' ) ); ?></option> 
  23. <option value="range"><?php echo esc_html( __( 'Slider', 'contact-form-7' ) ); ?></option> 
  24. </select> 
  25. <br /> 
  26. <label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label> 
  27. </fieldset> 
  28. </td> 
  29. </tr> 
  30.  
  31. <tr> 
  32. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th> 
  33. <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td> 
  34. </tr> 
  35.  
  36. <tr> 
  37. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><?php echo esc_html( __( 'Default value', 'contact-form-7' ) ); ?></label></th> 
  38. <td><input type="text" name="values" class="oneline" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>" /><br /> 
  39. <label><input type="checkbox" name="placeholder" class="option" /> <?php echo esc_html( __( 'Use this text as the placeholder of the field', 'contact-form-7' ) ); ?></label></td> 
  40. </tr> 
  41.  
  42. <tr> 
  43. <th scope="row"><?php echo esc_html( __( 'Range', 'contact-form-7' ) ); ?></th> 
  44. <td> 
  45. <fieldset> 
  46. <legend class="screen-reader-text"><?php echo esc_html( __( 'Range', 'contact-form-7' ) ); ?></legend> 
  47. <label> 
  48. <?php echo esc_html( __( 'Min', 'contact-form-7' ) ); ?> 
  49. <input type="number" name="min" class="numeric option" /> 
  50. </label> 
  51. – 
  52. <label> 
  53. <?php echo esc_html( __( 'Max', 'contact-form-7' ) ); ?> 
  54. <input type="number" name="max" class="numeric option" /> 
  55. </label> 
  56. </fieldset> 
  57. </td> 
  58. </tr> 
  59.  
  60. <tr> 
  61. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th> 
  62. <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td> 
  63. </tr> 
  64.  
  65. <tr> 
  66. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th> 
  67. <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td> 
  68. </tr> 
  69. </tbody> 
  70. </table> 
  71. </fieldset> 
  72. </div> 
  73.  
  74. <div class="insert-box"> 
  75. <input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" /> 
  76.  
  77. <div class="submitbox"> 
  78. <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" /> 
  79. </div> 
  80.  
  81. <br class="clear" /> 
  82.  
  83. <p class="description mail-tag"><label for="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>"><?php echo sprintf( esc_html( __( "To use the value input through this field in a mail field, you need to insert the corresponding mail-tag (%s) into the 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> 
  84. </div> 
  85. <?php