PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Http/Requests/ProductCreateRequest.php +11 -0 1.4.1 → 1.6.5 View file →
@@ -1,8 +1,9 @@
1 1 <?php
2 2
3 3 namespace FluentCart\App\Http\Requests;
4 4
5 +use FluentCart\App\Helpers\Helper;
5 6 use FluentCart\App\Models\ShippingClass;
6 7 use FluentCart\App\Services\DateTime\DateTime;
7 8 use FluentCart\Framework\Foundation\RequestGuard;
8 9 use FluentCart\Framework\Support\Arr;
@@ -40,8 +41,14 @@
40 41 return __('Invalid fulfillment type.', 'fluent-cart');
41 42 }
42 43 return null;
43 44 }],
45 + 'detail.variation_type' => ['sanitizeText', function ($attribute, $value) {
46 + if ($value !== null && $value !== '' && !in_array($value, Helper::getVariationTypes(false), true)) {
47 + return __('Invalid variation type.', 'fluent-cart');
48 + }
49 + return null;
50 + }],
44 51 ];
45 52 }
46 53
47 54
@@ -71,8 +78,12 @@
71 78 if (empty($value)) {
72 79 return 'digital';
73 80 }
74 81 return sanitize_text_field($value);
82 + },
83 +
84 + 'detail.variation_type' => function ($value) {
85 + return in_array($value, Helper::getVariationTypes(false), true) ? $value : 'simple';
75 86 },
76 87
77 88 'detail.other_info.is_bundle_product' => function ($value) {
78 89 return $value === 'yes' ? 'yes' : 'no';