| @@ -5,8 +5,9 @@ | ||
| 5 | 5 | use FluentCart\Framework\Foundation\RequestGuard; |
| 6 | 6 | use FluentCart\Framework\Support\Arr; |
| 7 | 7 | use FluentCart\App\Services\Permission\PermissionManager; |
| 8 | 8 | use FluentCart\App\Services\Theme\ColorPalette; |
| 9 | +use FluentCart\App\Services\Theme\RadiusPalette; | |
| 9 | 10 | |
| 10 | 11 | class FluentMetaRequest extends RequestGuard |
| 11 | 12 | { |
| 12 | 13 | |
| @@ -26,8 +27,14 @@ | ||
| 26 | 27 | ] |
| 27 | 28 | ]; |
| 28 | 29 | |
| 29 | 30 | $rules = Arr::get($rulesMap, $this->get('settings_name'), []); |
| 31 | + | |
| 32 | + // The radius fields only show under Customize; a value hidden under | |
| 33 | + // another source is dropped by the sanitiser rather than blocking the save. | |
| 34 | + if ($this->get('settings_name') === 'appearance' && $this->get('appearance_source') === ColorPalette::SOURCE_CUSTOM) { | |
| 35 | + $rules = array_merge($rules, RadiusPalette::validationRules()); | |
| 36 | + } | |
| 30 | 37 | // $rules = [ |
| 31 | 38 | // 'object_id' => 'integer|min:1', |
| 32 | 39 | // 'object_type' => 'nullable|sanitizeText|max:50', |
| 33 | 40 | // 'meta_key' => 'nullable|sanitizeText|max:50', |
| @@ -206,8 +213,15 @@ | ||
| 206 | 213 | } |
| 207 | 214 | } |
| 208 | 215 | |
| 209 | 216 | return $colors; |
| 217 | + }, | |
| 218 | + 'appearance_radius' => function ($value) { | |
| 219 | + // Registry-driven like the colours: only the known roles, each | |
| 220 | + // one length. A bare number means pixels; px, rem and em are | |
| 221 | + // kept as typed. An empty field means "not set", so the | |
| 222 | + // stylesheet's own fallback applies; 0 is a real value. | |
| 223 | + return RadiusPalette::sanitizeOwnerMap($value); | |
| 210 | 224 | }, |
| 211 | 225 | 'theme_setup' => function ($value) { |
| 212 | 226 | if (!is_array($value)) { |
| 213 | 227 | return []; |