← All changes
|
app/Services/FormBuilder/ElementCustomization.php
+176
-3
6.2.2
→
6.2.15
View file →
| @@ -16,8 +16,10 @@ | ||
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | $fluentformDateFormats = (new \FluentForm\App\Services\FormBuilder\Components\DateTime())->getAvailableDateFormats(); |
| 20 | +$fluentformRatingIconOptions = \FluentForm\App\Services\FormBuilder\RatingIcon::getPresetOptions(); | |
| 21 | +$fluentformCanAuthorDateConfig = fluentformCanUnfilteredHTML(); | |
| 20 | 22 | |
| 21 | 23 | $fluentformDateConfigSettings = [ |
| 22 | 24 | 'template' => 'inputTextarea', |
| 23 | 25 | 'label' => __('Advanced Date Configuration', 'fluentform'), |
| @@ -23,16 +25,18 @@ | ||
| 23 | 25 | 'label' => __('Advanced Date Configuration', 'fluentform'), |
| 24 | 26 | 'placeholder' => __('Advanced Date Configuration', 'fluentform'), |
| 25 | 27 | 'rows' => (defined('FLUENTFORMPRO')) ? 10 : 2, |
| 26 | 28 | 'start_text' => (defined('FLUENTFORMPRO')) ? 10 : 2, |
| 27 | - 'disabled' => ! defined('FLUENTFORMPRO'), | |
| 29 | + 'disabled' => ! defined('FLUENTFORMPRO') || ! $fluentformCanAuthorDateConfig, | |
| 28 | 30 | 'css_class' => 'ff_code_editor', |
| 29 | - 'inline_help_text' => 'Only valid JS object will work. Please check <a target="_blank" href="https://wpmanageninja.com/docs/fluent-form/field-types/time-date#advanced_configaration">the documentation for available config options</a>', | |
| 31 | + 'inline_help_text' => 'Only valid JS object will work. Please check <a target="_blank" href="https://docs.fluentforms.com/time-date-input-field">the documentation for available config options</a>', | |
| 30 | 32 | 'help_text' => __('You can write your own date configuration as JS object. Please write valid configuration as per flatpickr config.', 'fluentform'), |
| 31 | 33 | ]; |
| 32 | 34 | |
| 33 | 35 | if (! defined('FLUENTFORMPRO')) { |
| 34 | 36 | $fluentformDateConfigSettings['inline_help_text'] = 'Available on Fluent Forms Pro'; |
| 37 | +} elseif (! $fluentformCanAuthorDateConfig) { | |
| 38 | + $fluentformDateConfigSettings['inline_help_text'] = __('Only administrators can edit the Advanced Date Configuration.', 'fluentform'); | |
| 35 | 39 | } |
| 36 | 40 | |
| 37 | 41 | $fluentformElementCustomizationSettings = [ |
| 38 | 42 | 'name' => [ |
| @@ -104,8 +108,17 @@ | ||
| 104 | 108 | 'template' => 'inputText', |
| 105 | 109 | 'label' => __('Placeholder', 'fluentform'), |
| 106 | 110 | 'help_text' => __('This is the field placeholder, the user will see this if the input field is empty.', 'fluentform'), |
| 107 | 111 | ], |
| 112 | + 'autocomplete' => [ | |
| 113 | + 'template' => 'select', | |
| 114 | + 'label' => __('Autocomplete', 'fluentform'), | |
| 115 | + 'filterable' => true, | |
| 116 | + 'creatable' => true, | |
| 117 | + 'placeholder' => __('Select an autocomplete value', 'fluentform'), | |
| 118 | + 'help_text' => __('Tells the browser what kind of information this field collects so it can be autofilled, and lets assistive technology identify the input purpose (WCAG 1.3.5). Choose "off" to disable browser autofill, or "None" to add no attribute at all. You can also type a scoped value such as "billing postal-code". Anything outside the HTML autofill list is ignored when the form is displayed.', 'fluentform'), | |
| 119 | + 'options' => \FluentForm\App\Services\FormBuilder\AutocompleteTokens::editorOptions(), | |
| 120 | + ], | |
| 108 | 121 | 'date_format' => [ |
| 109 | 122 | 'template' => 'select', |
| 110 | 123 | 'label' => __('Date Format', 'fluentform'), |
| 111 | 124 | 'filterable' => true, |
| @@ -134,8 +147,13 @@ | ||
| 134 | 147 | 'template' => 'advancedOptions', |
| 135 | 148 | 'label' => __('Options', 'fluentform'), |
| 136 | 149 | 'help_text' => __('Create visual options for the field and checkmark them for default selection.', 'fluentform'), |
| 137 | 150 | ], |
| 151 | + 'enable_option_groups' => [ | |
| 152 | + 'template' => 'inputYesNoCheckBox', | |
| 153 | + 'label' => __('Enable Option Grouping', 'fluentform'), | |
| 154 | + 'help_text' => __('Turn this on to organize dropdown and multiselect options under group labels.', 'fluentform'), | |
| 155 | + ], | |
| 138 | 156 | 'enable_select_2' => [ |
| 139 | 157 | 'template' => 'inputYesNoCheckBox', |
| 140 | 158 | 'label' => __('Enable Searchable Smart Options', 'fluentform'), |
| 141 | 159 | 'help_text' => __('If you enable this then options will be searchable by select2 js library', 'fluentform'), |
| @@ -292,13 +310,47 @@ | ||
| 292 | 310 | 'value' => 'steps', |
| 293 | 311 | 'label' => __('Steps', 'fluentform'), |
| 294 | 312 | ], |
| 295 | 313 | [ |
| 314 | + 'value' => 'tabs', | |
| 315 | + 'label' => __('Tabs', 'fluentform'), | |
| 316 | + ], | |
| 317 | + [ | |
| 296 | 318 | 'value' => '', |
| 297 | 319 | 'label' => __('None', 'fluentform'), |
| 298 | 320 | ], |
| 299 | 321 | ], |
| 300 | 322 | ], |
| 323 | + 'progress_layout' => [ | |
| 324 | + 'template' => 'radioButton', | |
| 325 | + 'label' => __('Tab Position', 'fluentform'), | |
| 326 | + 'help_text' => __('Choose how step tabs should be displayed on the frontend.', 'fluentform'), | |
| 327 | + 'options' => [ | |
| 328 | + [ | |
| 329 | + 'value' => 'top', | |
| 330 | + 'label' => __('Top', 'fluentform'), | |
| 331 | + ], | |
| 332 | + [ | |
| 333 | + 'value' => 'left', | |
| 334 | + 'label' => __('Left', 'fluentform'), | |
| 335 | + ], | |
| 336 | + ], | |
| 337 | + 'dependency' => [ | |
| 338 | + 'depends_on' => 'settings/progress_indicator', | |
| 339 | + 'value' => 'tabs', | |
| 340 | + 'operator' => '==', | |
| 341 | + ], | |
| 342 | + ], | |
| 343 | + 'tabs_show_progress_bar' => [ | |
| 344 | + 'template' => 'inputYesNoCheckBox', | |
| 345 | + 'label' => __('Show Progress Bar Under Tabs', 'fluentform'), | |
| 346 | + 'help_text' => __('Enable a compact progress bar under the step tabs.', 'fluentform'), | |
| 347 | + 'dependency' => [ | |
| 348 | + 'depends_on' => 'settings/progress_indicator', | |
| 349 | + 'value' => 'tabs', | |
| 350 | + 'operator' => '==', | |
| 351 | + ], | |
| 352 | + ], | |
| 301 | 353 | 'step_animation' => [ |
| 302 | 354 | 'template' => 'radioButton', |
| 303 | 355 | 'label' => __('Animation type', 'fluentform'), |
| 304 | 356 | 'help_text' => __('Select any of them below, steps will change according to your choice.', 'fluentform'), |
| @@ -531,9 +583,9 @@ | ||
| 531 | 583 | 'help_text' => __('Please provide max number of rows the user can fill up for this repeat field. Keep blank/0 for unlimited numbers', 'fluentform'), |
| 532 | 584 | ], |
| 533 | 585 | 'calculation_settings' => [ |
| 534 | 586 | 'template' => (defined('FLUENTFORMPRO')) ? 'inputCalculationSettings' : 'infoBlock', |
| 535 | - 'text' => '<strong>Calculation Field Settings</strong><br/>Calculate the value based on other numeric field is available on pro version of Fluent Forms. Please install Fluent Forms Pro to use this feature <br /> <a target="_blank" rel="noopener" href="https://fluentforms.com/pricing/?utm_source=plugin&utm_medium=wp_install&utm_campaign=ff_upgrade&theme_style=twentytwentythree"> | |
| 587 | + 'text' => '<strong>Calculation Field Settings</strong><br/>Calculate the value based on other numeric field is available on pro version of Fluent Forms. Please install Fluent Forms Pro to use this feature <br /> <a target="_blank" rel="noopener" href="' . esc_url(fluentform_upgrade_url('feature_lock_calculation')) . '"> | |
| 536 | 588 | Upgrade to Pro </a>', |
| 537 | 589 | 'label' => 'Calculation Field Settings', |
| 538 | 590 | 'status_label' => 'Enable Calculation', |
| 539 | 591 | 'formula_label' => 'Calculation Expression', |
| @@ -589,8 +641,57 @@ | ||
| 589 | 641 | 'label' => __('No', 'fluentform'), |
| 590 | 642 | ], |
| 591 | 643 | ], |
| 592 | 644 | ], |
| 645 | + 'icon_source' => [ | |
| 646 | + 'template' => 'select', | |
| 647 | + 'label' => __('Icon Source', 'fluentform'), | |
| 648 | + 'help_text' => __('Choose a preset icon or provide a custom SVG icon for this rating field.', 'fluentform'), | |
| 649 | + 'options' => [ | |
| 650 | + [ | |
| 651 | + 'value' => 'preset', | |
| 652 | + 'label' => __('Preset Icons', 'fluentform'), | |
| 653 | + ], | |
| 654 | + [ | |
| 655 | + 'value' => 'custom_svg', | |
| 656 | + 'label' => __('Custom SVG', 'fluentform'), | |
| 657 | + ], | |
| 658 | + ], | |
| 659 | + ], | |
| 660 | + 'icon_type' => [ | |
| 661 | + 'template' => 'select', | |
| 662 | + 'label' => __('Preset Icon', 'fluentform'), | |
| 663 | + 'help_text' => __('Select which icon shape to use for this rating field.', 'fluentform'), | |
| 664 | + 'options' => $fluentformRatingIconOptions, | |
| 665 | + 'dependency' => [ | |
| 666 | + 'depends_on' => 'settings/icon_source', | |
| 667 | + 'value' => 'preset', | |
| 668 | + 'operator' => '==', | |
| 669 | + ], | |
| 670 | + ], | |
| 671 | + 'custom_icon_svg' => [ | |
| 672 | + 'template' => 'inputTextarea', | |
| 673 | + 'label' => __('Custom SVG Icon', 'fluentform'), | |
| 674 | + 'help_text' => __('Paste a single inline SVG. Unsupported tags and attributes will be stripped on save.', 'fluentform'), | |
| 675 | + 'placeholder' => __('<svg viewBox="0 0 24 24">...</svg>', 'fluentform'), | |
| 676 | + 'rows' => 6, | |
| 677 | + 'inline_help_text' => __('Use a simple monochrome SVG for the most predictable result across classic and conversational forms.', 'fluentform'), | |
| 678 | + 'dependency' => [ | |
| 679 | + 'depends_on' => 'settings/icon_source', | |
| 680 | + 'value' => 'custom_svg', | |
| 681 | + 'operator' => '==', | |
| 682 | + ], | |
| 683 | + ], | |
| 684 | + 'inactive_color' => [ | |
| 685 | + 'template' => 'inputColor', | |
| 686 | + 'label' => __('Inactive Color', 'fluentform'), | |
| 687 | + 'help_text' => __('Color used before a rating item is selected.', 'fluentform'), | |
| 688 | + ], | |
| 689 | + 'active_color' => [ | |
| 690 | + 'template' => 'inputColor', | |
| 691 | + 'label' => __('Active Color', 'fluentform'), | |
| 692 | + 'help_text' => __('Color used after a rating item becomes active or selected.', 'fluentform'), | |
| 693 | + ], | |
| 593 | 694 | 'numeric_formatter' => [ |
| 594 | 695 | 'template' => 'select', |
| 595 | 696 | 'label' => __('Number Format', 'fluentform'), |
| 596 | 697 | 'help_text' => __('Select the format of numbers that are allowed in this field. You have the option to use a comma or a dot as the decimal separator.', 'fluentform'), |
| @@ -719,8 +820,70 @@ | ||
| 719 | 820 | 'label' => __('Dropzone', 'fluentform'), |
| 720 | 821 | ], |
| 721 | 822 | ], |
| 722 | 823 | ], |
| 824 | + 'enable_crop' => [ | |
| 825 | + 'template' => 'inputYesNoCheckBox', | |
| 826 | + 'label' => __('Enable crop', 'fluentform'), | |
| 827 | + 'help_text' => __('If enabled, users must crop the image before it is uploaded.', 'fluentform'), | |
| 828 | + ], | |
| 829 | + 'crop_mode' => [ | |
| 830 | + 'template' => 'radioButton', | |
| 831 | + 'label' => __('Crop Type', 'fluentform'), | |
| 832 | + 'help_text' => __('Choose whether users crop by ratio or by exact width and height.', 'fluentform'), | |
| 833 | + 'options' => [ | |
| 834 | + [ | |
| 835 | + 'value' => 'ratio', | |
| 836 | + 'label' => __('Crop Ratio', 'fluentform'), | |
| 837 | + ], | |
| 838 | + [ | |
| 839 | + 'value' => 'dimensions', | |
| 840 | + 'label' => __('Width and Height', 'fluentform'), | |
| 841 | + ], | |
| 842 | + ], | |
| 843 | + 'dependency' => [ | |
| 844 | + 'depends_on' => 'settings/enable_crop', | |
| 845 | + 'value' => 'yes', | |
| 846 | + 'operator' => '==', | |
| 847 | + ], | |
| 848 | + ], | |
| 849 | + 'crop_ratio' => [ | |
| 850 | + 'template' => 'select', | |
| 851 | + 'label' => __('Crop ratio', 'fluentform'), | |
| 852 | + 'help_text' => __('Choose the default crop ratio users will see before upload.', 'fluentform'), | |
| 853 | + 'options' => [ | |
| 854 | + [ | |
| 855 | + 'value' => 'free', | |
| 856 | + 'label' => __('Free', 'fluentform'), | |
| 857 | + ], | |
| 858 | + [ | |
| 859 | + 'value' => '1:1', | |
| 860 | + 'label' => '1:1', | |
| 861 | + ], | |
| 862 | + [ | |
| 863 | + 'value' => '4:3', | |
| 864 | + 'label' => '4:3', | |
| 865 | + ], | |
| 866 | + [ | |
| 867 | + 'value' => '16:9', | |
| 868 | + 'label' => '16:9', | |
| 869 | + ], | |
| 870 | + [ | |
| 871 | + 'value' => '3:4', | |
| 872 | + 'label' => '3:4', | |
| 873 | + ], | |
| 874 | + ], | |
| 875 | + ], | |
| 876 | + 'crop_width' => [ | |
| 877 | + 'template' => 'inputNumber', | |
| 878 | + 'label' => __('Width (px)', 'fluentform'), | |
| 879 | + 'help_text' => __('Required crop width in pixels.', 'fluentform'), | |
| 880 | + ], | |
| 881 | + 'crop_height' => [ | |
| 882 | + 'template' => 'inputNumber', | |
| 883 | + 'label' => __('Height (px)', 'fluentform'), | |
| 884 | + 'help_text' => __('Required crop height in pixels.', 'fluentform'), | |
| 885 | + ], | |
| 723 | 886 | 'container_width' => [ |
| 724 | 887 | 'template' => 'containerWidth', |
| 725 | 888 | 'label' => __('Column Width %', 'fluentform'), |
| 726 | 889 | 'help_text' => __('Set the width of the columns. The minimum column width is 10%.', 'fluentform'), |
| @@ -759,8 +922,18 @@ | ||
| 759 | 922 | 'other_option_placeholder' => [ |
| 760 | 923 | 'template' => 'inputText', |
| 761 | 924 | 'label' => __('Other Option Placeholder', 'fluentform'), |
| 762 | 925 | 'help_text' => __('Placeholder text for the "Other" input field', 'fluentform'), |
| 926 | + 'dependency' => [ | |
| 927 | + 'depends_on' => 'settings/enable_other_option', | |
| 928 | + 'value' => 'yes', | |
| 929 | + 'operator' => '==', | |
| 930 | + ], | |
| 931 | + ], | |
| 932 | + 'other_option_required_message' => [ | |
| 933 | + 'template' => 'inputText', | |
| 934 | + 'label' => __('Other Option Required Message', 'fluentform'), | |
| 935 | + 'help_text' => __('Error message shown when the "Other" option is selected but its text field is left empty.', 'fluentform'), | |
| 763 | 936 | 'dependency' => [ |
| 764 | 937 | 'depends_on' => 'settings/enable_other_option', |
| 765 | 938 | 'value' => 'yes', |
| 766 | 939 | 'operator' => '==', |