Completed
Pull Request — master (#1422)
by Zack
17:24 queued 14:35
created
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Indentation   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 
103 103
 	/**
104 104
 	 * ID of the current post. May also be ID of the current View.
105
-     *
106
-     * @since 2.0.13
107 105
 	 *
108
-     * @var int
106
+	 * @since 2.0.13
107
+	 *
108
+	 * @var int
109 109
 	 */
110 110
 	public $post_id;
111 111
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function prevent_maybe_process_form() {
191 191
 
192
-	    if( ! $this->is_edit_entry_submission() ) {
192
+		if( ! $this->is_edit_entry_submission() ) {
193 193
 			return;
194 194
 		}
195 195
 
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 	 * When Edit entry view is requested setup the vars
229 229
 	 */
230 230
 	private function setup_vars() {
231
-        global $post;
231
+		global $post;
232 232
 
233 233
 		$gravityview_view = GravityView_View::getInstance();
234 234
 
235 235
 
236 236
 		$entries = $gravityview_view->getEntries();
237
-	    self::$original_entry = $entries[0];
238
-	    $this->entry = $entries[0];
237
+		self::$original_entry = $entries[0];
238
+		$this->entry = $entries[0];
239 239
 
240 240
 		self::$original_form = GFAPI::get_form( $this->entry['form_id'] );
241 241
 		$this->form = $gravityview_view->getForm();
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 
378 378
 			GFFormsModel::save_lead( $form, $this->entry );
379 379
 
380
-	        // Delete the values for hidden inputs
381
-	        $this->unset_hidden_field_values();
380
+			// Delete the values for hidden inputs
381
+			$this->unset_hidden_field_values();
382 382
 
383 383
 			$this->entry['date_created'] = $date_created;
384 384
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			// Perform actions normally performed after updating a lead
392 392
 			$this->after_update();
393 393
 
394
-	        /**
394
+			/**
395 395
 			 * Must be AFTER after_update()!
396 396
 			 * @see https://github.com/gravityview/GravityView/issues/764
397 397
 			 */
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
 			/**
401 401
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
402
-             * @since 2.1 Added $gv_data parameter
402
+			 * @since 2.1 Added $gv_data parameter
403 403
 			 * @param array $form Gravity Forms form array
404 404
 			 * @param string $entry_id Numeric ID of the entry that was updated
405 405
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 	 * @return void
424 424
 	 */
425 425
 	private function unset_hidden_field_values() {
426
-	    global $wpdb;
426
+		global $wpdb;
427 427
 
428 428
 		/**
429 429
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
448 448
 		}
449 449
 
450
-	    foreach ( $this->entry as $input_id => $field_value ) {
450
+		foreach ( $this->entry as $input_id => $field_value ) {
451 451
 
452 452
 			if ( ! is_numeric( $input_id ) ) {
453 453
 				continue;
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
 				continue;
458 458
 			}
459 459
 
460
-		    // Reset fields that are or would be hidden
461
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), $this->entry ) ) {
460
+			// Reset fields that are or would be hidden
461
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), $this->entry ) ) {
462 462
 
463 463
 				$empty_value = $field->get_value_save_entry(
464 464
 					is_array( $field->get_entry_inputs() ) ? array() : '',
@@ -470,16 +470,16 @@  discard block
 block discarded – undo
470 470
 					$empty_value = '';
471 471
 				}
472 472
 
473
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
473
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
474 474
 
475
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
475
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
476 476
 
477
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
477
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
478 478
 				// after submission
479
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
480
-			    $_POST[ $post_input_id ] = '';
481
-		    }
482
-	    }
479
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
480
+				$_POST[ $post_input_id ] = '';
481
+			}
482
+		}
483 483
 	}
484 484
 
485 485
 	/**
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 
635 635
 		$form = $this->filter_conditional_logic( $this->form );
636 636
 
637
-	    /** @var GF_Field $field */
637
+		/** @var GF_Field $field */
638 638
 		foreach( $form['fields'] as $k => &$field ) {
639 639
 
640 640
 			/**
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 
651 651
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
652 652
 				foreach( $field->inputs as $key => $input ) {
653
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
653
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
654 654
 				}
655 655
 			}
656 656
 		}
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 
691 691
 				$inputs = $field->get_entry_inputs();
692 692
 				if ( is_array( $inputs ) ) {
693
-				    foreach ( $inputs as $input ) {
693
+					foreach ( $inputs as $input ) {
694 694
 						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
695 695
 
696 696
 						if ( 'product' === $field->type ) {
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 						}
710 710
 
711 711
 						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
712
-				    }
712
+					}
713 713
 				} else {
714 714
 					// Set to what it previously was if it's not editable
715 715
 					if ( ! in_array( $field->id, $allowed_fields ) ) {
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
756 756
 
757 757
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
758
-	        $ary = stripslashes_deep( $ary );
758
+			$ary = stripslashes_deep( $ary );
759 759
 			$img_url = \GV\Utils::get( $ary, 0 );
760 760
 
761 761
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 	private function maybe_update_post_fields( $form ) {
829 829
 
830 830
 		if( empty( $this->entry['post_id'] ) ) {
831
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
831
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
832 832
 			return;
833 833
 		}
834 834
 
@@ -863,49 +863,49 @@  discard block
 block discarded – undo
863 863
 
864 864
 				switch( $field->type ) {
865 865
 
866
-				    case 'post_title':
867
-				        $post_title = $value;
868
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
869
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
870
-				        }
871
-				        $updated_post->post_title = $post_title;
872
-				        $updated_post->post_name  = $post_title;
873
-				        unset( $post_title );
874
-				        break;
875
-
876
-				    case 'post_content':
877
-				        $post_content = $value;
878
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
879
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
880
-				        }
881
-				        $updated_post->post_content = $post_content;
882
-				        unset( $post_content );
883
-				        break;
884
-				    case 'post_excerpt':
885
-				        $updated_post->post_excerpt = $value;
886
-				        break;
887
-				    case 'post_tags':
888
-				        wp_set_post_tags( $post_id, $value, false );
889
-				        break;
890
-				    case 'post_category':
891
-				        break;
892
-				    case 'post_custom_field':
866
+					case 'post_title':
867
+						$post_title = $value;
868
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
869
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
870
+						}
871
+						$updated_post->post_title = $post_title;
872
+						$updated_post->post_name  = $post_title;
873
+						unset( $post_title );
874
+						break;
875
+
876
+					case 'post_content':
877
+						$post_content = $value;
878
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
879
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
880
+						}
881
+						$updated_post->post_content = $post_content;
882
+						unset( $post_content );
883
+						break;
884
+					case 'post_excerpt':
885
+						$updated_post->post_excerpt = $value;
886
+						break;
887
+					case 'post_tags':
888
+						wp_set_post_tags( $post_id, $value, false );
889
+						break;
890
+					case 'post_category':
891
+						break;
892
+					case 'post_custom_field':
893 893
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
894 894
 							$value = $value[ $field_id ];
895 895
 						}
896 896
 
897
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
898
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
899
-				        }
897
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
898
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
899
+						}
900 900
 
901 901
 						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
902 902
 
903
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
904
-				        break;
903
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
904
+						break;
905 905
 
906
-				    case 'post_image':
907
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
908
-				        break;
906
+					case 'post_image':
907
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
908
+						break;
909 909
 
910 910
 				}
911 911
 
@@ -1075,14 +1075,14 @@  discard block
 block discarded – undo
1075 1075
 			?><h2 class="gv-edit-entry-title">
1076 1076
 				<span><?php
1077 1077
 
1078
-				    /**
1079
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
1080
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
1081
-				     * @param GravityView_Edit_Entry_Render $this This object
1082
-				     */
1083
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1078
+					/**
1079
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
1080
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
1081
+					 * @param GravityView_Edit_Entry_Render $this This object
1082
+					 */
1083
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1084 1084
 
1085
-				    echo esc_attr( $edit_entry_title );
1085
+					echo esc_attr( $edit_entry_title );
1086 1086
 			?></span>
1087 1087
 			</h2>
1088 1088
 
@@ -1137,13 +1137,13 @@  discard block
 block discarded – undo
1137 1137
 				);
1138 1138
 
1139 1139
 				/**
1140
-				* @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1141
-				* @since 1.16.3
1142
-				* @param array $labels Default button labels associative array
1143
-				* @param array $form The Gravity Forms form
1144
-				* @param array $entry The Gravity Forms entry
1145
-				* @param int $view_id The current View ID
1146
-				*/
1140
+				 * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1141
+				 * @since 1.16.3
1142
+				 * @param array $labels Default button labels associative array
1143
+				 * @param array $form The Gravity Forms form
1144
+				 * @param array $entry The Gravity Forms entry
1145
+				 * @param int $view_id The current View ID
1146
+				 */
1147 1147
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1148 1148
 
1149 1149
 				$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
@@ -1180,26 +1180,26 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
 				switch ( $edit_redirect ) {
1182 1182
 
1183
-                    case '0':
1184
-	                    $redirect_url = $back_link;
1185
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1186
-                        break;
1187
-
1188
-                    case '1':
1189
-	                    $redirect_url = $directory_link = GravityView_API::directory_link();
1190
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1191
-	                    break;
1192
-
1193
-                    case '2':
1194
-	                    $redirect_url = $edit_redirect_url;
1195
-	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1196
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1197
-                        break;
1198
-
1199
-                    case '':
1200
-                    default:
1201
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1202
-                        break;
1183
+					case '0':
1184
+						$redirect_url = $back_link;
1185
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1186
+						break;
1187
+
1188
+					case '1':
1189
+						$redirect_url = $directory_link = GravityView_API::directory_link();
1190
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1191
+						break;
1192
+
1193
+					case '2':
1194
+						$redirect_url = $edit_redirect_url;
1195
+						$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1196
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1197
+						break;
1198
+
1199
+					case '':
1200
+					default:
1201
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1202
+						break;
1203 1203
 				}
1204 1204
 
1205 1205
 				if ( isset( $redirect_url ) ) {
@@ -1265,13 +1265,13 @@  discard block
 block discarded – undo
1265 1265
 				);
1266 1266
 
1267 1267
 				/**
1268
-				* @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1269
-				* @since 1.16.3
1270
-				* @param array $labels Default button labels associative array
1271
-				* @param array $form The Gravity Forms form
1272
-				* @param array $entry The Gravity Forms entry
1273
-				* @param int $view_id The current View ID
1274
-				*/
1268
+				 * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1269
+				 * @since 1.16.3
1270
+				 * @param array $labels Default button labels associative array
1271
+				 * @param array $form The Gravity Forms form
1272
+				 * @param array $entry The Gravity Forms entry
1273
+				 * @param int $view_id The current View ID
1274
+				 */
1275 1275
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1276 1276
 
1277 1277
 				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
 
1318 1318
 		ob_get_clean();
1319 1319
 
1320
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1320
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1321 1321
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1322 1322
 		remove_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1323 1323
 		remove_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 
1378 1378
 		// for now we don't support Save and Continue feature.
1379 1379
 		if( ! self::$supports_save_and_continue ) {
1380
-	        unset( $form['save'] );
1380
+			unset( $form['save'] );
1381 1381
 		}
1382 1382
 
1383 1383
 		$form = $this->unselect_default_values( $form );
@@ -1404,30 +1404,30 @@  discard block
 block discarded – undo
1404 1404
 			return $field_content;
1405 1405
 		}
1406 1406
 
1407
-        $message = null;
1407
+		$message = null;
1408 1408
 
1409
-        // First, make sure they have the capability to edit the post.
1410
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1409
+		// First, make sure they have the capability to edit the post.
1410
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1411 1411
 
1412
-            /**
1413
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1414
-             * @param string $message The existing "You don't have permission..." text
1415
-             */
1416
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1412
+			/**
1413
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1414
+			 * @param string $message The existing "You don't have permission..." text
1415
+			 */
1416
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1417 1417
 
1418
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1419
-            /**
1420
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1421
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1422
-             */
1423
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1424
-        }
1418
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1419
+			/**
1420
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1421
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1422
+			 */
1423
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1424
+		}
1425 1425
 
1426
-        if( $message ) {
1427
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1428
-        }
1426
+		if( $message ) {
1427
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1428
+		}
1429 1429
 
1430
-        return $field_content;
1430
+		return $field_content;
1431 1431
 	}
1432 1432
 
1433 1433
 	/**
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 			|| ! empty( $field_content )
1456 1456
 			|| in_array( $field->type, array( 'honeypot' ) )
1457 1457
 		) {
1458
-	        return $field_content;
1458
+			return $field_content;
1459 1459
 		}
1460 1460
 
1461 1461
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1463,24 +1463,24 @@  discard block
 block discarded – undo
1463 1463
 
1464 1464
 		$field_value = $this->get_field_value( $field );
1465 1465
 
1466
-	    // Prevent any PHP warnings, like undefined index
1467
-	    ob_start();
1466
+		// Prevent any PHP warnings, like undefined index
1467
+		ob_start();
1468 1468
 
1469
-	    $return = null;
1469
+		$return = null;
1470 1470
 
1471 1471
 		/** @var GravityView_Field $gv_field */
1472 1472
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1473 1473
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1474 1474
 		} else {
1475
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1476
-	    }
1475
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1476
+		}
1477 1477
 
1478
-	    // If there was output, it's an error
1479
-	    $warnings = ob_get_clean();
1478
+		// If there was output, it's an error
1479
+		$warnings = ob_get_clean();
1480 1480
 
1481
-	    if( !empty( $warnings ) ) {
1482
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1483
-	    }
1481
+		if( !empty( $warnings ) ) {
1482
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1483
+		}
1484 1484
 
1485 1485
 		return $return;
1486 1486
 	}
@@ -1515,8 +1515,8 @@  discard block
 block discarded – undo
1515 1515
 				$input_id = strval( $input['id'] );
1516 1516
 
1517 1517
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1518
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1519
-				    $allow_pre_populated = false;
1518
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1519
+					$allow_pre_populated = false;
1520 1520
 				}
1521 1521
 
1522 1522
 			}
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1541 1541
 				$categories = array();
1542 1542
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1543
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1543
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1544 1544
 				}
1545 1545
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1546 1546
 			}
@@ -1550,25 +1550,25 @@  discard block
 block discarded – undo
1550 1550
 		// if value is empty get the default value if defined
1551 1551
 		$field_value = $field->get_value_default_if_empty( $field_value );
1552 1552
 
1553
-	    /**
1554
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1555
-	     * @since 1.11
1556
-	     * @since 1.20 Added third param
1557
-	     * @param mixed $field_value field value used to populate the input
1558
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1559
-	     * @param GravityView_Edit_Entry_Render $this Current object
1560
-	     */
1561
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1562
-
1563
-	    /**
1564
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1565
-	     * @since 1.17
1566
-	     * @since 1.20 Added third param
1567
-	     * @param mixed $field_value field value used to populate the input
1568
-	     * @param GF_Field $field Gravity Forms field object
1569
-	     * @param GravityView_Edit_Entry_Render $this Current object
1570
-	     */
1571
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1553
+		/**
1554
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1555
+		 * @since 1.11
1556
+		 * @since 1.20 Added third param
1557
+		 * @param mixed $field_value field value used to populate the input
1558
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1559
+		 * @param GravityView_Edit_Entry_Render $this Current object
1560
+		 */
1561
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1562
+
1563
+		/**
1564
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1565
+		 * @since 1.17
1566
+		 * @since 1.20 Added third param
1567
+		 * @param mixed $field_value field value used to populate the input
1568
+		 * @param GF_Field $field Gravity Forms field object
1569
+		 * @param GravityView_Edit_Entry_Render $this Current object
1570
+		 */
1571
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1572 1572
 
1573 1573
 		return $field_value;
1574 1574
 	}
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1596 1596
 			// expects certain field array items to be set.
1597 1597
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1598
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1598
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1599 1599
 			}
1600 1600
 
1601 1601
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1609,61 +1609,61 @@  discard block
 block discarded – undo
1609 1609
 				 */
1610 1610
 				case 'fileupload':
1611 1611
 
1612
-				    // Set the previous value
1613
-				    $entry = $this->get_entry();
1612
+					// Set the previous value
1613
+					$entry = $this->get_entry();
1614 1614
 
1615
-				    $input_name = 'input_'.$field->id;
1616
-				    $form_id = $form['id'];
1615
+					$input_name = 'input_'.$field->id;
1616
+					$form_id = $form['id'];
1617 1617
 
1618
-				    $value = NULL;
1618
+					$value = NULL;
1619 1619
 
1620
-				    // Use the previous entry value as the default.
1621
-				    if( isset( $entry[ $field->id ] ) ) {
1622
-				        $value = $entry[ $field->id ];
1623
-				    }
1620
+					// Use the previous entry value as the default.
1621
+					if( isset( $entry[ $field->id ] ) ) {
1622
+						$value = $entry[ $field->id ];
1623
+					}
1624 1624
 
1625
-				    // If this is a single upload file
1626
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1627
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1628
-				        $value = $file_path['url'];
1625
+					// If this is a single upload file
1626
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1627
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1628
+						$value = $file_path['url'];
1629 1629
 
1630
-				    } else {
1630
+					} else {
1631 1631
 
1632
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1633
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1634
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1632
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1633
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1634
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1635 1635
 
1636
-				    }
1636
+					}
1637 1637
 
1638
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1638
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1639 1639
 
1640
-				        // If there are fresh uploads, process and merge them.
1641
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1642
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1643
-				            $value = empty( $value ) ? '[]' : $value;
1644
-				            $value = stripslashes_deep( $value );
1645
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1646
-				        }
1640
+						// If there are fresh uploads, process and merge them.
1641
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1642
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1643
+							$value = empty( $value ) ? '[]' : $value;
1644
+							$value = stripslashes_deep( $value );
1645
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1646
+						}
1647 1647
 
1648
-				    } else {
1648
+					} else {
1649 1649
 
1650
-				        // A file already exists when editing an entry
1651
-				        // We set this to solve issue when file upload fields are required.
1652
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1650
+						// A file already exists when editing an entry
1651
+						// We set this to solve issue when file upload fields are required.
1652
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1653 1653
 
1654
-				    }
1654
+					}
1655 1655
 
1656
-				    $this->entry[ $input_name ] = $value;
1657
-				    $_POST[ $input_name ] = $value;
1656
+					$this->entry[ $input_name ] = $value;
1657
+					$_POST[ $input_name ] = $value;
1658 1658
 
1659
-				    break;
1659
+					break;
1660 1660
 
1661 1661
 				case 'number':
1662
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1663
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1664
-				        $_POST['input_'.$field->id ] = NULL;
1665
-				    }
1666
-				    break;
1662
+					// Fix "undefined index" issue at line 1286 in form_display.php
1663
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1664
+						$_POST['input_'.$field->id ] = NULL;
1665
+					}
1666
+					break;
1667 1667
 			}
1668 1668
 
1669 1669
 		}
@@ -1748,43 +1748,43 @@  discard block
 block discarded – undo
1748 1748
 				case 'fileupload' :
1749 1749
 				case 'post_image':
1750 1750
 
1751
-				    // in case nothing is uploaded but there are already files saved
1752
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1753
-				        $field->failed_validation = false;
1754
-				        unset( $field->validation_message );
1755
-				    }
1751
+					// in case nothing is uploaded but there are already files saved
1752
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1753
+						$field->failed_validation = false;
1754
+						unset( $field->validation_message );
1755
+					}
1756 1756
 
1757
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1758
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1757
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1758
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1759 1759
 
1760
-				        $input_name = 'input_' . $field->id;
1761
-				        //uploaded
1762
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1760
+						$input_name = 'input_' . $field->id;
1761
+						//uploaded
1762
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1763 1763
 
1764
-				        //existent
1765
-				        $entry = $this->get_entry();
1766
-				        $value = NULL;
1767
-				        if( isset( $entry[ $field->id ] ) ) {
1768
-				            $value = json_decode( $entry[ $field->id ], true );
1769
-				        }
1764
+						//existent
1765
+						$entry = $this->get_entry();
1766
+						$value = NULL;
1767
+						if( isset( $entry[ $field->id ] ) ) {
1768
+							$value = json_decode( $entry[ $field->id ], true );
1769
+						}
1770 1770
 
1771
-				        // count uploaded files and existent entry files
1772
-				        $count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1773
-						               ( is_array( $value ) ? count( $value ) : 0 );
1771
+						// count uploaded files and existent entry files
1772
+						$count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1773
+									   ( is_array( $value ) ? count( $value ) : 0 );
1774 1774
 
1775
-				        if( $count_files > $field->maxFiles ) {
1776
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1777
-				            $field->failed_validation = 1;
1778
-				            $gv_valid = false;
1775
+						if( $count_files > $field->maxFiles ) {
1776
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1777
+							$field->failed_validation = 1;
1778
+							$gv_valid = false;
1779 1779
 
1780
-				            // in case of error make sure the newest upload files are removed from the upload input
1781
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1782
-				        }
1780
+							// in case of error make sure the newest upload files are removed from the upload input
1781
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1782
+						}
1783 1783
 
1784
-				    }
1784
+					}
1785 1785
 
1786 1786
 
1787
-				    break;
1787
+					break;
1788 1788
 
1789 1789
 			}
1790 1790
 
@@ -1795,47 +1795,47 @@  discard block
 block discarded – undo
1795 1795
 
1796 1796
 				switch ( $field_type ) {
1797 1797
 
1798
-				    // Captchas don't need to be re-entered.
1799
-				    case 'captcha':
1798
+					// Captchas don't need to be re-entered.
1799
+					case 'captcha':
1800 1800
 
1801
-				        // Post Image fields aren't editable, so we un-fail them.
1802
-				    case 'post_image':
1803
-				        $field->failed_validation = false;
1804
-				        unset( $field->validation_message );
1805
-				        break;
1801
+						// Post Image fields aren't editable, so we un-fail them.
1802
+					case 'post_image':
1803
+						$field->failed_validation = false;
1804
+						unset( $field->validation_message );
1805
+						break;
1806 1806
 
1807 1807
 				}
1808 1808
 
1809 1809
 				// You can't continue inside a switch, so we do it after.
1810 1810
 				if( empty( $field->failed_validation ) ) {
1811
-				    continue;
1811
+					continue;
1812 1812
 				}
1813 1813
 
1814 1814
 				// checks if the No Duplicates option is not validating entry against itself, since
1815 1815
 				// we're editing a stored entry, it would also assume it's a duplicate.
1816 1816
 				if( !empty( $field->noDuplicates ) ) {
1817 1817
 
1818
-				    $entry = $this->get_entry();
1818
+					$entry = $this->get_entry();
1819 1819
 
1820
-				    // If the value of the entry is the same as the stored value
1821
-				    // Then we can assume it's not a duplicate, it's the same.
1822
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1823
-				        //if value submitted was not changed, then don't validate
1824
-				        $field->failed_validation = false;
1820
+					// If the value of the entry is the same as the stored value
1821
+					// Then we can assume it's not a duplicate, it's the same.
1822
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1823
+						//if value submitted was not changed, then don't validate
1824
+						$field->failed_validation = false;
1825 1825
 
1826
-				        unset( $field->validation_message );
1826
+						unset( $field->validation_message );
1827 1827
 
1828
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1828
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1829 1829
 
1830
-				        continue;
1831
-				    }
1830
+						continue;
1831
+					}
1832 1832
 				}
1833 1833
 
1834 1834
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1835 1835
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1836
-				    unset( $field->validation_message );
1837
-	                $field->validation_message = false;
1838
-				    continue;
1836
+					unset( $field->validation_message );
1837
+					$field->validation_message = false;
1838
+					continue;
1839 1839
 				}
1840 1840
 
1841 1841
 				$gv_valid = false;
@@ -1899,8 +1899,8 @@  discard block
 block discarded – undo
1899 1899
 		// Hide fields depending on admin settings
1900 1900
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1901 1901
 
1902
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1903
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1902
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1903
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1904 1904
 
1905 1905
 		/**
1906 1906
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1991,11 +1991,11 @@  discard block
 block discarded – undo
1991 1991
 		// The edit tab has been configured, so we loop through to configured settings
1992 1992
 		foreach ( $configured_fields as $configured_field ) {
1993 1993
 
1994
-	        /** @var GF_Field $field */
1995
-	        foreach ( $fields as $field ) {
1994
+			/** @var GF_Field $field */
1995
+			foreach ( $fields as $field ) {
1996 1996
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1997
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1998
-				    break;
1997
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1998
+					break;
1999 1999
 				}
2000 2000
 
2001 2001
 			}
@@ -2051,28 +2051,28 @@  discard block
 block discarded – undo
2051 2051
 	 */
2052 2052
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
2053 2053
 
2054
-	    /**
2054
+		/**
2055 2055
 		 * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true
2056
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
2057
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
2058
-	     * @since 1.9.1
2059
-	     * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
2060
-	     * @param array $form GF Form array
2061
-	     * @param int $view_id View ID
2062
-	     */
2063
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2064
-
2065
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2056
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
2057
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
2058
+		 * @since 1.9.1
2059
+		 * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
2060
+		 * @param array $form GF Form array
2061
+		 * @param int $view_id View ID
2062
+		 */
2063
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2064
+
2065
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2066 2066
 			foreach( $fields as $k => $field ) {
2067 2067
 				if( $field->adminOnly ) {
2068
-				    unset( $fields[ $k ] );
2068
+					unset( $fields[ $k ] );
2069 2069
 				}
2070 2070
 			}
2071 2071
 			return array_values( $fields );
2072 2072
 		}
2073 2073
 
2074
-	    foreach( $fields as &$field ) {
2075
-		    $field->adminOnly = false;
2074
+		foreach( $fields as &$field ) {
2075
+			$field->adminOnly = false;
2076 2076
 		}
2077 2077
 
2078 2078
 		return $fields;
@@ -2092,13 +2092,13 @@  discard block
 block discarded – undo
2092 2092
 	 */
2093 2093
 	private function unselect_default_values( $form ) {
2094 2094
 
2095
-	    foreach ( $form['fields'] as &$field ) {
2095
+		foreach ( $form['fields'] as &$field ) {
2096 2096
 
2097 2097
 			if ( empty( $field->choices ) ) {
2098
-                continue;
2098
+				continue;
2099 2099
 			}
2100 2100
 
2101
-            foreach ( $field->choices as &$choice ) {
2101
+			foreach ( $field->choices as &$choice ) {
2102 2102
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2103 2103
 					$choice['isSelected'] = false;
2104 2104
 				}
@@ -2135,36 +2135,36 @@  discard block
 block discarded – undo
2135 2135
 
2136 2136
 			if( 'checkbox' === $field->type ) {
2137 2137
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2138
-				    $input_id = $input['id'];
2139
-				    $choice = $field->choices[ $key ];
2140
-				    $value = \GV\Utils::get( $this->entry, $input_id );
2141
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2142
-				    if( $match ) {
2143
-				        $field->choices[ $key ]['isSelected'] = true;
2144
-				    }
2138
+					$input_id = $input['id'];
2139
+					$choice = $field->choices[ $key ];
2140
+					$value = \GV\Utils::get( $this->entry, $input_id );
2141
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
2142
+					if( $match ) {
2143
+						$field->choices[ $key ]['isSelected'] = true;
2144
+					}
2145 2145
 				}
2146 2146
 			} else {
2147 2147
 
2148 2148
 				// We need to run through each field to set the default values
2149 2149
 				foreach ( $this->entry as $field_id => $field_value ) {
2150 2150
 
2151
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2151
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
2152 2152
 
2153
-				        if( 'list' === $field->type ) {
2154
-				            $list_rows = maybe_unserialize( $field_value );
2153
+						if( 'list' === $field->type ) {
2154
+							$list_rows = maybe_unserialize( $field_value );
2155 2155
 
2156
-				            $list_field_value = array();
2157
-				            foreach ( (array) $list_rows as $row ) {
2158
-				                foreach ( (array) $row as $column ) {
2159
-				                    $list_field_value[] = $column;
2160
-				                }
2161
-				            }
2156
+							$list_field_value = array();
2157
+							foreach ( (array) $list_rows as $row ) {
2158
+								foreach ( (array) $row as $column ) {
2159
+									$list_field_value[] = $column;
2160
+								}
2161
+							}
2162 2162
 
2163
-				            $field->defaultValue = serialize( $list_field_value );
2164
-				        } else {
2165
-				            $field->defaultValue = $field_value;
2166
-				        }
2167
-				    }
2163
+							$field->defaultValue = serialize( $list_field_value );
2164
+						} else {
2165
+							$field->defaultValue = $field_value;
2166
+						}
2167
+					}
2168 2168
 				}
2169 2169
 			}
2170 2170
 		}
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
 			foreach ( $form['fields'] as &$field ) {
2226 2226
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2227 2227
 
2228
-				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2228
+					list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2229 2229
 
2230 2230
 					if ( $field['id'] == $rule_field_id ) {
2231 2231
 						unset( $field->conditionalLogic['rules'][ $rule_i ] );
@@ -2276,7 +2276,7 @@  discard block
 block discarded – undo
2276 2276
 			return $has_conditional_logic;
2277 2277
 		}
2278 2278
 
2279
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2279
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2280 2280
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
2281 2281
 	}
2282 2282
 
@@ -2343,14 +2343,14 @@  discard block
 block discarded – undo
2343 2343
 
2344 2344
 		if( $echo && $error !== true ) {
2345 2345
 
2346
-	        $error = esc_html( $error );
2346
+			$error = esc_html( $error );
2347 2347
 
2348
-	        /**
2349
-	         * @since 1.9
2350
-	         */
2351
-	        if ( ! empty( $this->entry ) ) {
2352
-		        $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
2353
-	        }
2348
+			/**
2349
+			 * @since 1.9
2350
+			 */
2351
+			if ( ! empty( $this->entry ) ) {
2352
+				$error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
2353
+			}
2354 2354
 
2355 2355
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2356 2356
 		}
Please login to merge, or discard this patch.