GravityView  2.10.1
The best, easiest way to display Gravity Forms entries on your website.
form-buttons.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file form-buttons.php
4  * @global GravityView_Edit_Entry_Render $object
5  */
6 
7 if ( current_filter() === 'gform_previous_button' ) {
8  if ( $object->show_previous_button || $object->show_update_button ) {
9  return; // Will be called later once more
10  }
11 }
12 
13 if ( current_filter() === 'gform_next_button' ) {
14  if ( $object->show_update_button ) {
15  return; // Will be called later once more
16  }
17 }
18 
19 ?>
20 <div id="publishing-action">
21  <?php
22 
23  /**
24  * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL
25  * @since 1.11.1
26  * @param string $back_link Existing URL of the Cancel link
27  * @param array $form The Gravity Forms form
28  * @param array $entry The Gravity Forms entry
29  * @param int $view_id The current View ID
30  */
31  $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id );
32 
33  /**
34  * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container.
35  * @since 1.5.1
36  * @param array $form The Gravity Forms form
37  * @param array $entry The Gravity Forms entry
38  * @param int $view_id The current View ID
39  */
40  do_action( 'gravityview/edit-entry/publishing-action/before', $object->form, $object->entry, $object->view_id );
41 
42 
43  $labels = array(
44  'cancel' => __( 'Cancel', 'gravityview' ),
45  'submit' => __( 'Update', 'gravityview' ),
46  'next' => __( 'Next', 'gravityview' ),
47  'previous' => __( 'Previous', 'gravityview' ),
48  );
49 
50  /**
51  * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
52  * @since 1.16.3
53  * @param array $labels Default button labels associative array
54  * @param array $form The Gravity Forms form
55  * @param array $entry The Gravity Forms entry
56  * @param int $view_id The current View ID
57  */
58  $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $object->form, $object->entry, $object->view_id );
59 
60  if ( $object->show_previous_button ) {
61  $previous_tabindex = GFCommon::get_tabindex();
62  ?>
63  <input id="gform_previous_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-previous" type="submit" <?php echo $previous_tabindex; ?> value="<?php echo esc_attr( $labels['previous'] ); ?>" name="save" />
64  <?php
65  }
66 
67  if ( $object->show_next_button ) {
68  $next_tabindex = GFCommon::get_tabindex();
69  ?>
70  <input id="gform_next_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-next" type="submit" <?php echo $next_tabindex; ?> value="<?php echo esc_attr( $labels['next'] ); ?>" name="save" />
71  <?php
72  }
73 
74  if ( $object->show_update_button ) {
75  $update_tabindex = GFCommon::get_tabindex();
76  ?>
77  <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" />
78  <?php
79  }
80 
81  $cancel_tabindex = GFCommon::get_tabindex();
82 
83  ?>
84  <a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a>
85  <?php
86 
87  /**
88  * @action `gravityview/edit-entry/publishing-action/after` Triggered after the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container.
89  * @since 1.5.1
90  * @since 2.0.13 Added $post_id
91  * @param array $form The Gravity Forms form
92  * @param array $entry The Gravity Forms entry
93  * @param int $view_id The current View ID
94  * @param int $post_id The current Post ID
95  */
96  do_action( 'gravityview/edit-entry/publishing-action/after', $object->form, $object->entry, $object->view_id, $object->post_id );
97 
98  ?>
99  <input type="hidden" name="action" value="update" />
100  <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" />
101 </div>
$labels
if(current_filter()==='gform_previous_button') if(current_filter()==='gform_next_button') $back_link
if( $object->show_previous_button) if( $object->show_next_button) if( $object->show_update_button) $cancel_tabindex