@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | if ( 'address' === rgar( $search_field, 'type' ) ) { |
| 60 | 60 | |
| 61 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
| 62 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
| 61 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
| 62 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
| 63 | 63 | $form = GravityView_View::getInstance()->getForm(); |
| 64 | 64 | |
| 65 | 65 | /** @var GF_Field_Address $address_field */ |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $choices = array(); |
| 69 | 69 | |
| 70 | 70 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
| 71 | - if( method_exists( $this, $method_name ) ) { |
|
| 71 | + if ( method_exists( $this, $method_name ) ) { |
|
| 72 | 72 | /** |
| 73 | 73 | * @uses GravityView_Field_Address::get_choices_country() |
| 74 | 74 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | $choices = $this->{$method_name}( $address_field ); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if( ! empty( $choices ) ) { |
|
| 80 | - $search_field['choices'] = $choices; |
|
| 81 | - $search_field['type'] = rgar( $search_field, 'input'); |
|
| 79 | + if ( ! empty( $choices ) ) { |
|
| 80 | + $search_field[ 'choices' ] = $choices; |
|
| 81 | + $search_field[ 'type' ] = rgar( $search_field, 'input' ); |
|
| 82 | 82 | } else { |
| 83 | - $search_field['type'] = 'text'; |
|
| 84 | - $search_field['input'] = 'input_text'; |
|
| 83 | + $search_field[ 'type' ] = 'text'; |
|
| 84 | + $search_field[ 'input' ] = 'input_text'; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $country_choices = array(); |
| 108 | 108 | |
| 109 | 109 | foreach ( $countries as $key => $country ) { |
| 110 | - $country_choices[] = array( |
|
| 110 | + $country_choices[ ] = array( |
|
| 111 | 111 | 'value' => $country, |
| 112 | 112 | 'text' => $country, |
| 113 | 113 | ); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | private function get_choices_state( $address_field ) { |
| 133 | 133 | |
| 134 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
| 134 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
| 135 | 135 | |
| 136 | 136 | $state_choices = array(); |
| 137 | 137 | |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | $states = GFCommon::get_canadian_provinces(); |
| 144 | 144 | break; |
| 145 | 145 | default: |
| 146 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
| 146 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
| 147 | 147 | break; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | foreach ( $states as $key => $state ) { |
| 151 | - $state_choices[] = array( |
|
| 151 | + $state_choices[ ] = array( |
|
| 152 | 152 | 'value' => $state, |
| 153 | 153 | 'text' => $state, |
| 154 | 154 | ); |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | // Use the same inputs as the "text" input type allows |
| 172 | 172 | $text_inputs = rgar( $input_types, 'text' ); |
| 173 | 173 | |
| 174 | - $input_types['street'] = $text_inputs; |
|
| 175 | - $input_types['street2'] = $text_inputs; |
|
| 176 | - $input_types['city'] = $text_inputs; |
|
| 174 | + $input_types[ 'street' ] = $text_inputs; |
|
| 175 | + $input_types[ 'street2' ] = $text_inputs; |
|
| 176 | + $input_types[ 'city' ] = $text_inputs; |
|
| 177 | 177 | |
| 178 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 179 | - $input_types['zip'] = array( 'input_text' ); |
|
| 180 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 178 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 179 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
| 180 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 181 | 181 | |
| 182 | 182 | return $input_types; |
| 183 | 183 | } |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
| 199 | 199 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
| 200 | 200 | |
| 201 | - if( 'address' === $field_type && $input_id ) { |
|
| 201 | + if ( 'address' === $field_type && $input_id ) { |
|
| 202 | 202 | |
| 203 | 203 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
| 204 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 204 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 205 | 205 | $input_type = $address_field_name; |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -250,20 +250,20 @@ discard block |
||
| 250 | 250 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 251 | 251 | |
| 252 | 252 | // If this is NOT the full address field, return default options. |
| 253 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 253 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 254 | 254 | return $field_options; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - if( 'edit' === $context ) { |
|
| 257 | + if ( 'edit' === $context ) { |
|
| 258 | 258 | return $field_options; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $add_options = array(); |
| 262 | 262 | |
| 263 | - $add_options['show_map_link'] = array( |
|
| 263 | + $add_options[ 'show_map_link' ] = array( |
|
| 264 | 264 | 'type' => 'checkbox', |
| 265 | 265 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 266 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
| 266 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
| 267 | 267 | 'value' => true, |
| 268 | 268 | 'merge_tags' => false, |
| 269 | 269 | ); |