wpcf7_editor_box_mail

The Contact Form 7 wpcf7 editor box mail function.

Description

wpcf7_editor_box_mail( $post, (string) $args = '' ); 

Parameters (2)

0. $post
The post.
1. $args — Optional. (string) => ''
The args.

Usage

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

Defined (1)

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

/admin/includes/editor.php  
  1. function wpcf7_editor_box_mail( $post, $args = '' ) { 
  2. $args = wp_parse_args( $args, array( 
  3. 'id' => 'wpcf7-mail',  
  4. 'name' => 'mail',  
  5. 'title' => __( 'Mail', 'contact-form-7' ),  
  6. 'use' => null,  
  7. ) ); 
  8.  
  9. $id = esc_attr( $args['id'] ); 
  10.  
  11. $mail = wp_parse_args( $post->prop( $args['name'] ), array( 
  12. 'active' => false,  
  13. 'recipient' => '',  
  14. 'sender' => '',  
  15. 'subject' => '',  
  16. 'body' => '',  
  17. 'additional_headers' => '',  
  18. 'attachments' => '',  
  19. 'use_html' => false,  
  20. 'exclude_blank' => false,  
  21. ) ); 
  22.  
  23. ?> 
  24. <div class="contact-form-editor-box-mail" id="<?php echo $id; ?>"> 
  25. <h2><?php echo esc_html( $args['title'] ); ?></h2> 
  26.  
  27. <?php 
  28. if ( ! empty( $args['use'] ) ) : 
  29. ?> 
  30. <label for="<?php echo $id; ?>-active"><input type="checkbox" id="<?php echo $id; ?>-active" name="<?php echo $id; ?>[active]" class="toggle-form-table" value="1"<?php echo ( $mail['active'] ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( $args['use'] ); ?></label> 
  31. <p class="description"><?php echo esc_html( __( "Mail (2) is an additional mail template often used as an autoresponder.", 'contact-form-7' ) ); ?></p> 
  32. <?php 
  33. endif; 
  34. ?> 
  35.  
  36. <fieldset> 
  37. <legend><?php echo esc_html( __( "In the following fields, you can use these mail-tags:", 'contact-form-7' ) ); ?><br /> 
  38. <?php $post->suggest_mail_tags( $args['name'] ); ?></legend> 
  39. <table class="form-table"> 
  40. <tbody> 
  41. <tr> 
  42. <th scope="row"> 
  43. <label for="<?php echo $id; ?>-recipient"><?php echo esc_html( __( 'To', 'contact-form-7' ) ); ?></label> 
  44. </th> 
  45. <td> 
  46. <input type="text" id="<?php echo $id; ?>-recipient" name="<?php echo $id; ?>[recipient]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['recipient'] ); ?>" data-config-field="<?php echo sprintf( '%s.recipient', esc_attr( $args['name'] ) ); ?>" /> 
  47. </td> 
  48. </tr> 
  49.  
  50. <tr> 
  51. <th scope="row"> 
  52. <label for="<?php echo $id; ?>-sender"><?php echo esc_html( __( 'From', 'contact-form-7' ) ); ?></label> 
  53. </th> 
  54. <td> 
  55. <input type="text" id="<?php echo $id; ?>-sender" name="<?php echo $id; ?>[sender]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['sender'] ); ?>" data-config-field="<?php echo sprintf( '%s.sender', esc_attr( $args['name'] ) ); ?>" /> 
  56. </td> 
  57. </tr> 
  58.  
  59. <tr> 
  60. <th scope="row"> 
  61. <label for="<?php echo $id; ?>-subject"><?php echo esc_html( __( 'Subject', 'contact-form-7' ) ); ?></label> 
  62. </th> 
  63. <td> 
  64. <input type="text" id="<?php echo $id; ?>-subject" name="<?php echo $id; ?>[subject]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['subject'] ); ?>" data-config-field="<?php echo sprintf( '%s.subject', esc_attr( $args['name'] ) ); ?>" /> 
  65. </td> 
  66. </tr> 
  67.  
  68. <tr> 
  69. <th scope="row"> 
  70. <label for="<?php echo $id; ?>-additional-headers"><?php echo esc_html( __( 'Additional Headers', 'contact-form-7' ) ); ?></label> 
  71. </th> 
  72. <td> 
  73. <textarea id="<?php echo $id; ?>-additional-headers" name="<?php echo $id; ?>[additional_headers]" cols="100" rows="4" class="large-text code" data-config-field="<?php echo sprintf( '%s.additional_headers', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['additional_headers'] ); ?></textarea> 
  74. </td> 
  75. </tr> 
  76.  
  77. <tr> 
  78. <th scope="row"> 
  79. <label for="<?php echo $id; ?>-body"><?php echo esc_html( __( 'Message Body', 'contact-form-7' ) ); ?></label> 
  80. </th> 
  81. <td> 
  82. <textarea id="<?php echo $id; ?>-body" name="<?php echo $id; ?>[body]" cols="100" rows="18" class="large-text code" data-config-field="<?php echo sprintf( '%s.body', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['body'] ); ?></textarea> 
  83.  
  84. <p><label for="<?php echo $id; ?>-exclude-blank"><input type="checkbox" id="<?php echo $id; ?>-exclude-blank" name="<?php echo $id; ?>[exclude_blank]" value="1"<?php echo ( ! empty( $mail['exclude_blank'] ) ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( __( 'Exclude lines with blank mail-tags from output', 'contact-form-7' ) ); ?></label></p> 
  85.  
  86. <p><label for="<?php echo $id; ?>-use-html"><input type="checkbox" id="<?php echo $id; ?>-use-html" name="<?php echo $id; ?>[use_html]" value="1"<?php echo ( $mail['use_html'] ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( __( 'Use HTML content type', 'contact-form-7' ) ); ?></label></p> 
  87. </td> 
  88. </tr> 
  89.  
  90. <tr> 
  91. <th scope="row"> 
  92. <label for="<?php echo $id; ?>-attachments"><?php echo esc_html( __( 'File Attachments', 'contact-form-7' ) ); ?></label> 
  93. </th> 
  94. <td> 
  95. <textarea id="<?php echo $id; ?>-attachments" name="<?php echo $id; ?>[attachments]" cols="100" rows="4" class="large-text code" data-config-field="<?php echo sprintf( '%s.attachments', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['attachments'] ); ?></textarea> 
  96. </td> 
  97. </tr> 
  98. </tbody> 
  99. </table> 
  100. </fieldset> 
  101. </div> 
  102. <?php