| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | use FluentForm\App\Helpers\Helper; |
| 6 | 6 | use FluentForm\App\Modules\Acl\Acl; |
| 7 | 7 | use FluentForm\App\Modules\Payments\PaymentHelper; |
| 8 | +use FluentForm\App\Services\FormBuilder\RatingIcon; | |
| 8 | 9 | use FluentForm\Framework\Foundation\Application; |
| 9 | 10 | use FluentForm\Framework\Helpers\ArrayHelper; |
| 10 | 11 | |
| 11 | 12 | class Form |
| @@ -442,11 +443,22 @@ | ||
| 442 | 443 | 'help_message' => 'wp_kses_post', |
| 443 | 444 | 'admin_field_label' => 'sanitize_text_field', |
| 444 | 445 | 'prefix_label' => 'sanitize_text_field', |
| 445 | 446 | 'suffix_label' => 'sanitize_text_field', |
| 447 | + 'icon_source' => 'sanitize_key', | |
| 448 | + 'icon_type' => 'sanitize_key', | |
| 449 | + 'custom_icon_svg' => [RatingIcon::class, 'sanitizeCustomSvg'], | |
| 450 | + 'inactive_color' => [RatingIcon::class, 'sanitizeColor'], | |
| 451 | + 'active_color' => [RatingIcon::class, 'sanitizeColor'], | |
| 446 | 452 | 'unique_validation_message' => 'sanitize_text_field', |
| 447 | 453 | 'advanced_options' => 'fluentform_options_sanitize', |
| 448 | 454 | 'html_codes' => 'fluentform_sanitize_html', |
| 455 | + 'enable_crop' => 'sanitize_text_field', | |
| 456 | + 'crop_mode' => 'sanitize_text_field', | |
| 457 | + 'crop_ratio' => 'sanitize_text_field', | |
| 458 | + 'crop_width' => 'absint', | |
| 459 | + 'crop_height' => 'absint', | |
| 460 | + 'enforce_image_dimensions' => 'sanitize_text_field', | |
| 449 | 461 | ]; |
| 450 | 462 | $settingsKeys = array_keys($settingsMap); |
| 451 | 463 | $stylePrefMap = [ |
| 452 | 464 | 'layout' => 'sanitize_key', |
| @@ -655,8 +667,19 @@ | ||
| 655 | 667 | if ($duplicates) { |
| 656 | 668 | $duplicateString = implode(', ', $duplicates); |
| 657 | 669 | wp_send_json([ |
| 658 | 670 | 'title' => sprintf('Name attribute %s has duplicate value.', $duplicateString), |
| 671 | + ], 422); | |
| 672 | + } | |
| 673 | + | |
| 674 | + $duplicateRankingFields = Helper::getRankingFieldsWithDuplicateOptionValues($fields); | |
| 675 | + if ($duplicateRankingFields) { | |
| 676 | + $duplicateRankingFields = implode(', ', array_unique($duplicateRankingFields)); | |
| 677 | + wp_send_json([ | |
| 678 | + 'title' => sprintf( | |
| 679 | + __('Ranking field %s has duplicate option values. Please make each option value unique.', 'fluentform'), | |
| 680 | + $duplicateRankingFields | |
| 681 | + ), | |
| 659 | 682 | ], 422); |
| 660 | 683 | } |
| 661 | 684 | } |
| 662 | 685 | |