gravityview /
GravityView
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @package GravityView |
||
| 4 | * @subpackage Gravityview/admin/metaboxes/views |
||
| 5 | * @since 1.8 |
||
| 6 | * @global WP_Post $post |
||
| 7 | */ |
||
| 8 | |||
| 9 | |||
| 10 | // Use nonce for verification |
||
| 11 | wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' ); |
||
| 12 | |||
| 13 | //current value |
||
| 14 | $current_form = (int) rgar( (array) $_GET, 'form_id', gravityview_get_form_id( $post->ID ) ); |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 15 | |||
| 16 | // check for available gravity forms |
||
| 17 | $forms = gravityview_get_forms(); |
||
| 18 | |||
| 19 | ?> |
||
| 20 | <label for="gravityview_form_id" ><?php esc_html_e( 'Where would you like the data to come from for this View?', 'gravityview' ); ?></label> |
||
| 21 | |||
| 22 | <p> |
||
| 23 | <?php |
||
| 24 | |||
| 25 | if ( empty( $current_form ) && GVCommon::has_cap( 'gravityforms_create_form' ) ) { |
||
| 26 | ?> |
||
| 27 | <a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Start Fresh', 'gravityview' ); ?>"><?php esc_html_e( 'Start Fresh', 'gravityview' ); ?></a> |
||
| 28 | |||
| 29 | <?php if( !empty( $forms ) ) { ?> |
||
| 30 | <span> <?php esc_html_e( 'or use an existing form', 'gravityview' ); ?> </span> |
||
| 31 | <?php } |
||
| 32 | } |
||
| 33 | |||
| 34 | // If there are no forms to select, show no forms. |
||
| 35 | if( !empty( $forms ) ) { ?> |
||
| 36 | <select name="gravityview_form_id" id="gravityview_form_id"> |
||
| 37 | <option value="" <?php selected( '', $current_form, true ); ?>>— <?php esc_html_e( 'list of forms', 'gravityview' ); ?> —</option> |
||
| 38 | <?php foreach( $forms as $form ) { ?> |
||
| 39 | <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
||
| 40 | <?php } ?> |
||
| 41 | </select> |
||
| 42 | <?php } else { ?> |
||
| 43 | <select name="gravityview_form_id" id="gravityview_form_id" class="hidden"><option selected="selected" value=""></option></select> |
||
| 44 | <?php } ?> |
||
| 45 | |||
| 46 | <a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a> |
||
| 47 | </p> |
||
| 48 | |||
| 49 | <?php // confirm dialog box ?> |
||
| 50 | <div id="gravityview_form_id_dialog" class="gv-dialog-options gv-dialog-warning" title="<?php esc_attr_e( 'Attention', 'gravityview' ); ?>"> |
||
| 51 | <p><?php esc_html_e( 'Changing the form will reset your field configuration. Changes will be permanent once you save the View.', 'gravityview' ); ?></p> |
||
| 52 | </div> |
||
| 53 | |||
| 54 | <?php // confirm template dialog box ?> |
||
| 55 | <div id="gravityview_switch_template_dialog" class="gv-dialog-options gv-dialog-warning" title="<?php esc_attr_e( 'Attention', 'gravityview' ); ?>"> |
||
| 56 | <p><?php esc_html_e( 'Changing the View Type will reset your field configuration. Changes will be permanent once you save the View.', 'gravityview' ); ?></p> |
||
| 57 | </div> |
||
| 58 | |||
| 59 | <?php // no js notice ?> |
||
| 60 | <div class="error hide-if-js"> |
||
| 61 | <p><?php esc_html_e( 'GravityView requires Javascript to be enabled.', 'gravityview' ); ?></p> |
||
| 62 | </div> |
||
| 63 | |||
| 64 | <?php |
||
| 65 | // hidden field to keep track of start fresh state ?> |
||
| 66 | <input type="hidden" id="gravityview_form_id_start_fresh" name="gravityview_form_id_start_fresh" value="0" /> |
||
| 67 |