PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / trunk
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder vtrunk
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/Name.php +9 -1 6.2.14 → trunk View file →
@@ -1,8 +1,9 @@
1 1 <?php
2 2
3 3 namespace FluentForm\App\Services\FormBuilder\Components;
4 4
5 +use FluentForm\App\Services\FormBuilder\AutocompleteTokens;
5 6 use FluentForm\App\Helpers\Helper;
6 7 use FluentForm\Framework\Helpers\ArrayHelper;
7 8 use FluentForm\App\Services\FormBuilder\Components\Select;
8 9
@@ -45,10 +46,11 @@
45 46 $data['attributes']['class'] .= ' ff-field_container ff-name-field-wrapper';
46 47 if ($containerClass = ArrayHelper::get($data, 'settings.container_class')) {
47 48 $data['attributes']['class'] .= ' ' . $containerClass;
48 49 }
50 + // autocomplete belongs to the sub-fields, not to this wrapper <div>.
49 51 $atts = $this->buildAttributes(
50 - ArrayHelper::except($data['attributes'], 'name')
52 + ArrayHelper::except($data['attributes'], ['name', 'autocomplete'])
51 53 );
52 54
53 55 $html = "<div {$atts}>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $atts is escaped before being passed in.
54 56 $html .= "<div class='ff-t-container'>";
@@ -63,8 +65,14 @@
63 65 foreach ($data['fields'] as $field) {
64 66 if ($field['settings']['visible']) {
65 67 $fieldName = $field['attributes']['name'];
66 68 $field['attributes']['name'] = $rootName . '[' . $fieldName . ']';
69 +
70 + $field['attributes']['autocomplete'] = AutocompleteTokens::forSubField(
71 + $fieldName,
72 + ArrayHelper::get($data, 'attributes.autocomplete'),
73 + ArrayHelper::get($field, 'attributes.autocomplete')
74 + );
67 75 @$field['attributes']['class'] = trim(
68 76 'ff-el-form-control ' .
69 77 $field['attributes']['class']
70 78 );