wpcf7_tag_generator_checkbox
The Contact Form 7 wpcf7 tag generator checkbox function.
Description
Parameters (2)
- 0. $contact_form
- The contact form.
- 1. $args — Optional. (string) =>
''
- The args.
Usage
if ( !function_exists( 'wpcf7_tag_generator_checkbox' ) ) { require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/checkbox.php'; } // The contact form. $contact_form = null; // The args. $args = ''; // NOTICE! Understand what this does before running. $result = wpcf7_tag_generator_checkbox($contact_form, $args);
Defined (1)
The function is defined in the following location(s).
- /modules/checkbox.php
- function wpcf7_tag_generator_checkbox( $contact_form, $args = '' ) {
- $args = wp_parse_args( $args, array() );
- $type = $args['id'];
- if ( 'radio' != $type ) {
- $type = 'checkbox';
- }
- if ( 'checkbox' == $type ) {
- $description = __( "Generate a form-tag for a group of checkboxes. For more details, see %s.", 'contact-form-7' );
- } elseif ( 'radio' == $type ) {
- $description = __( "Generate a form-tag for a group of radio buttons. For more details, see %s.", 'contact-form-7' );
- }
- $desc_link = wpcf7_link( __( 'https://contactform7.com/checkboxes-radio-buttons-and-menus/', 'contact-form-7' ), __( 'Checkboxes, Radio Buttons and Menus', 'contact-form-7' ) );
- ?>
- <div class="control-box">
- <fieldset>
- <legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend>
- <table class="form-table">
- <tbody>
- <?php if ( 'checkbox' == $type ) : ?>
- <tr>
- <th scope="row"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></th>
- <td>
- <fieldset>
- <legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend>
- <label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label>
- </fieldset>
- </td>
- </tr>
- <?php endif; ?>
- <tr>
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th>
- <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
- </tr>
- <tr>
- <th scope="row"><?php echo esc_html( __( 'Options', 'contact-form-7' ) ); ?></th>
- <td>
- <fieldset>
- <legend class="screen-reader-text"><?php echo esc_html( __( 'Options', 'contact-form-7' ) ); ?></legend>
- <textarea name="values" class="values" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>"></textarea>
- <label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><span class="description"><?php echo esc_html( __( "One option per line.", 'contact-form-7' ) ); ?></span></label><br />
- <label><input type="checkbox" name="label_first" class="option" /> <?php echo esc_html( __( 'Put a label first, a checkbox last', 'contact-form-7' ) ); ?></label><br />
- <label><input type="checkbox" name="use_label_element" class="option" /> <?php echo esc_html( __( 'Wrap each item with label element', 'contact-form-7' ) ); ?></label>
- <?php if ( 'checkbox' == $type ) : ?>
- <br /><label><input type="checkbox" name="exclusive" class="option" /> <?php echo esc_html( __( 'Make checkboxes exclusive', 'contact-form-7' ) ); ?></label>
- <?php endif; ?>
- </fieldset>
- </td>
- </tr>
- <tr>
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
- <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
- </tr>
- <tr>
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
- <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
- </tr>
- </tbody>
- </table>
- </fieldset>
- </div>
- <div class="insert-box">
- <input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
- <div class="submitbox">
- <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
- </div>
- <br class="clear" />
- <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>
- </div>
- <?php