Completed
Push — develop ( 52fa37...767238 )
by Zack
44:12 queued 24:13
created
includes/widgets/search-widget/templates/search-field-select.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
 $search_field = $gravityview_view->search_field;
11 11
 
12 12
 // Make sure that there are choices to display
13
-if( empty( $search_field['choices'] ) ) {
13
+if ( empty( $search_field[ 'choices' ] ) ) {
14 14
 	gravityview()->log->debug( 'search-field-select.php - No choices for field' );
15 15
 	return;
16 16
 }
17 17
 
18
-if( is_array( $search_field['value'] ) ) {
18
+if ( is_array( $search_field[ 'value' ] ) ) {
19 19
     gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' );
20
-	$search_field['value'] = reset( $search_field['value'] );
20
+	$search_field[ 'value' ] = reset( $search_field[ 'value' ] );
21 21
 }
22 22
 
23
-$gf_field = GFAPI::get_field( $gravityview_view->getForm(), $search_field['key'] );
23
+$gf_field = GFAPI::get_field( $gravityview_view->getForm(), $search_field[ 'key' ] );
24 24
 $placeholder = \GV\Utils::get( $gf_field, 'placeholder', '' );
25 25
 
26 26
 /**
@@ -29,26 +29,26 @@  discard block
 block discarded – undo
29 29
  * @param string $default_option Default: `—` (—)
30 30
  * @param string $field_type Field type: "select" or "multiselect"
31 31
  */
32
-$default_option = apply_filters('gravityview/extension/search/select_default', ( '' === $placeholder ? '—' : $placeholder ), 'select' );
32
+$default_option = apply_filters( 'gravityview/extension/search/select_default', ( '' === $placeholder ? '—' : $placeholder ), 'select' );
33 33
 
34 34
 ?>
35 35
 <div class="gv-search-box gv-search-field-select">
36
-	<?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?>
37
-		<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label>
36
+	<?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?>
37
+		<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label>
38 38
 	<?php } ?>
39 39
 	<p>
40
-		<select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>">
41
-			<option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option>
40
+		<select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>">
41
+			<option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option>
42 42
 			<?php
43
-			foreach( $search_field['choices'] as $choice ) { ?>
44
-				<?php if ( is_array( $choice['value'] ) ) { ?>
45
-					<optgroup label="<?php echo esc_attr( $choice['text'] ); ?>">
46
-						<?php foreach ( $choice['value'] as $subchoice ): ?>
47
-							<option value="<?php echo esc_attr( $subchoice['value'] ); ?>"><?php echo esc_html( $subchoice['text'] ); ?></option>
43
+			foreach ( $search_field[ 'choices' ] as $choice ) { ?>
44
+				<?php if ( is_array( $choice[ 'value' ] ) ) { ?>
45
+					<optgroup label="<?php echo esc_attr( $choice[ 'text' ] ); ?>">
46
+						<?php foreach ( $choice[ 'value' ] as $subchoice ): ?>
47
+							<option value="<?php echo esc_attr( $subchoice[ 'value' ] ); ?>"><?php echo esc_html( $subchoice[ 'text' ] ); ?></option>
48 48
 						<?php endforeach; ?>
49 49
 					</optgroup>
50 50
 				<?php } else { ?>
51
-					<option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $search_field['value'] ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option>
51
+					<option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $search_field[ 'value' ] ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option>
52 52
 				<?php } ?>
53 53
 			<?php } ?>
54 54
 		</select>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-multiselect.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 $search_field = $gravityview_view->search_field;
11 11
 
12 12
 // Make sure that there are choices to display
13
-if( empty( $search_field['choices'] ) ) {
13
+if ( empty( $search_field[ 'choices' ] ) ) {
14 14
 	gravityview()->log->debug( 'search-field-multiselect.php - No choices for field' );
15 15
 	return;
16 16
 }
17 17
 
18
-$gf_field = GFAPI::get_field( $gravityview_view->getForm(), $search_field['key'] );
18
+$gf_field = GFAPI::get_field( $gravityview_view->getForm(), $search_field[ 'key' ] );
19 19
 $placeholder = \GV\Utils::get( $gf_field, 'placeholder', '' );
20 20
 
21 21
 /**
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
  * @param string $default_option Default: `&mdash;` (—)
25 25
  * @param string $field_type Field type: "select" or "multiselect"
26 26
  */
27
-$default_option = apply_filters('gravityview/extension/search/select_default', ( '' === $placeholder ? '&mdash;' : $placeholder ), 'multiselect' );
27
+$default_option = apply_filters( 'gravityview/extension/search/select_default', ( '' === $placeholder ? '&mdash;' : $placeholder ), 'multiselect' );
28 28
 
29 29
 ?>
30 30
 <div class="gv-search-box gv-search-field-multiselect">
31
-	<?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?>
32
-		<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label>
31
+	<?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?>
32
+		<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label>
33 33
 	<?php } ?>
34 34
 	<p>
35
-		<select name="<?php echo esc_attr( $search_field['name'] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" multiple>
36
-			<option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option>
35
+		<select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" multiple>
36
+			<option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option>
37 37
 			<?php
38
-			foreach( $search_field['choices'] as $choice ) : ?>
39
-				<option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option>
38
+			foreach ( $search_field[ 'choices' ] as $choice ) : ?>
39
+				<option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option>
40 40
 			<?php endforeach; ?>
41 41
 		</select>
42 42
 	</p>
Please login to merge, or discard this patch.