@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | if ( 'address' === \GV\Utils::get( $search_field, 'type' ) ) { |
62 | 62 | |
63 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
64 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
63 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
64 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
65 | 65 | $form = GravityView_View::getInstance()->getForm(); |
66 | 66 | |
67 | 67 | /** @var GF_Field_Address $address_field */ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $choices = array(); |
71 | 71 | |
72 | 72 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
73 | - if( method_exists( $this, $method_name ) ) { |
|
73 | + if ( method_exists( $this, $method_name ) ) { |
|
74 | 74 | /** |
75 | 75 | * @uses GravityView_Field_Address::get_choices_country() |
76 | 76 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $choices = $this->{$method_name}( $address_field, $form ); |
79 | 79 | } |
80 | 80 | |
81 | - if( ! empty( $choices ) ) { |
|
82 | - $search_field['choices'] = $choices; |
|
83 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
81 | + if ( ! empty( $choices ) ) { |
|
82 | + $search_field[ 'choices' ] = $choices; |
|
83 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
84 | 84 | } else { |
85 | - $search_field['type'] = 'text'; |
|
86 | - $search_field['input'] = 'input_text'; |
|
85 | + $search_field[ 'type' ] = 'text'; |
|
86 | + $search_field[ 'input' ] = 'input_text'; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $country_choices = array(); |
110 | 110 | |
111 | 111 | foreach ( $countries as $key => $country ) { |
112 | - $country_choices[] = array( |
|
112 | + $country_choices[ ] = array( |
|
113 | 113 | 'value' => $country, |
114 | 114 | 'text' => $country, |
115 | 115 | ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function get_choices_state( $address_field, $form ) { |
136 | 136 | |
137 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
137 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
138 | 138 | |
139 | 139 | $state_choices = array(); |
140 | 140 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $states = GFCommon::get_canadian_provinces(); |
147 | 147 | break; |
148 | 148 | default: |
149 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
150 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
149 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
150 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
151 | 151 | break; |
152 | 152 | } |
153 | 153 | |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | $state_subchoices = array(); |
157 | 157 | |
158 | 158 | foreach ( $state as $key => $substate ) { |
159 | - $state_subchoices[] = array( |
|
159 | + $state_subchoices[ ] = array( |
|
160 | 160 | 'value' => is_numeric( $key ) ? $substate : $key, |
161 | 161 | 'text' => $substate, |
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - $state_choices[] = array( |
|
165 | + $state_choices[ ] = array( |
|
166 | 166 | 'text' => $key, |
167 | 167 | 'value' => $state_subchoices, |
168 | 168 | ); |
169 | 169 | |
170 | 170 | } else { |
171 | - $state_choices[] = array( |
|
171 | + $state_choices[ ] = array( |
|
172 | 172 | 'value' => is_numeric( $key ) ? $state : $key, |
173 | 173 | 'text' => $state, |
174 | 174 | ); |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | // Use the same inputs as the "text" input type allows |
193 | 193 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
194 | 194 | |
195 | - $input_types['street'] = $text_inputs; |
|
196 | - $input_types['street2'] = $text_inputs; |
|
197 | - $input_types['city'] = $text_inputs; |
|
195 | + $input_types[ 'street' ] = $text_inputs; |
|
196 | + $input_types[ 'street2' ] = $text_inputs; |
|
197 | + $input_types[ 'city' ] = $text_inputs; |
|
198 | 198 | |
199 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
200 | - $input_types['zip'] = array( 'input_text' ); |
|
201 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
199 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
200 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
201 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
202 | 202 | |
203 | 203 | return $input_types; |
204 | 204 | } |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
220 | 220 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
221 | 221 | |
222 | - if( 'address' === $field_type && $input_id ) { |
|
222 | + if ( 'address' === $field_type && $input_id ) { |
|
223 | 223 | |
224 | 224 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
225 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
225 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
226 | 226 | $input_type = $address_field_name; |
227 | 227 | } |
228 | 228 | } |
@@ -271,20 +271,20 @@ discard block |
||
271 | 271 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
272 | 272 | |
273 | 273 | // If this is NOT the full address field, return default options. |
274 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
274 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
275 | 275 | return $field_options; |
276 | 276 | } |
277 | 277 | |
278 | - if( 'edit' === $context ) { |
|
278 | + if ( 'edit' === $context ) { |
|
279 | 279 | return $field_options; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $add_options = array(); |
283 | 283 | |
284 | - $add_options['show_map_link'] = array( |
|
284 | + $add_options[ 'show_map_link' ] = array( |
|
285 | 285 | 'type' => 'checkbox', |
286 | 286 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
287 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
287 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
288 | 288 | 'value' => true, |
289 | 289 | 'merge_tags' => false, |
290 | 290 | ); |