PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.15
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.15
6.2.15 6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 All 197 releases
← All changes | app/Services/FormBuilder/Components/Address.php +13 -3 6.2.2 → 6.2.15 View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace FluentForm\App\Services\FormBuilder\Components;
4 4
5 5 use FluentForm\App\Helpers\Helper;
6 +use FluentForm\App\Services\FormBuilder\AutocompleteTokens;
6 7 use FluentForm\Framework\Helpers\ArrayHelper;
7 8
8 9 class Address extends BaseComponent
9 10 {
@@ -28,10 +29,12 @@
28 29 $data = apply_filters('fluentform/rendering_field_data_' . $elementName, $data, $form);
29 30
30 31 $rootName = $data['attributes']['name'];
31 32 $hasConditions = $this->hasConditions($data) ? 'has-conditions ' : '';
32 - $data['attributes']['class'] .= ' ff-name-address-wrapper ' . $this->wrapperClass . ' ' . $hasConditions;
33 - $data['attributes']['class'] = trim($data['attributes']['class']);
33 + $data['attributes']['class'] = trim(
34 + ArrayHelper::get($data, 'attributes.class', '')
35 + . ' ff-name-address-wrapper ' . $this->wrapperClass . ' ' . $hasConditions
36 + );
34 37
35 38 $provider = ArrayHelper::get($data, 'settings.autocomplete_provider');
36 39 $legacyGoogleEnable = ArrayHelper::get($data, 'settings.enable_g_autocomplete', 'no') === 'yes';
37 40 $isLegacyProvider = !ArrayHelper::has($data, 'settings.autocomplete_provider');
@@ -69,10 +72,11 @@
69 72 $data['attributes']['data-name'] = $data['attributes']['name'];
70 73 do_action('fluentform/address_map_autocomplete', $data, $form);
71 74 }
72 75
76 + // autocomplete belongs to the sub-fields, not to this wrapper <div>.
73 77 $atts = $this->buildAttributes(
74 - ArrayHelper::except($data['attributes'], 'name')
78 + ArrayHelper::except($data['attributes'], ['name', 'autocomplete'])
75 79 );
76 80
77 81 //re order fields from version 4.3.2
78 82 if ($order = ArrayHelper::get($data, 'settings.field_order')) {
@@ -112,8 +116,14 @@
112 116 if ($item['settings']['visible']) {
113 117 $itemName = $item['attributes']['name'];
114 118 $item['attributes']['data-key_name'] = $itemName;
115 119 $item['attributes']['name'] = $rootName . '[' . $itemName . ']';
120 +
121 + $item['attributes']['autocomplete'] = AutocompleteTokens::forSubField(
122 + $itemName,
123 + ArrayHelper::get($data, 'attributes.autocomplete'),
124 + ArrayHelper::get($item, 'attributes.autocomplete')
125 + );
116 126
117 127 if ('select_country' === $item['element'] && $googleAutoComplete) {
118 128 $selectedCountries = (array) ArrayHelper::get($item, 'attributes.value', []);
119 129 if ('visible_list' === ArrayHelper::get($item, 'settings.country_list.active_list')) {