| @@ -32,11 +32,14 @@ | ||
| 32 | 32 | * stylesheet paints the default — so it takes Divi's default here too. A |
| 33 | 33 | * value FluentCart cannot write (rgb(), rgba(), Divi 5's `hsl(from var(--gcid…))` |
| 34 | 34 | * or a `$variable(…)$` reference) is not stated. |
| 35 | 35 | * |
| 36 | + * Its Buttons → Border Radius (`all_buttons_border_radius`) is the button | |
| 37 | + * radius (see radii()). Divi has no form-field or product-card radius setting. | |
| 38 | + * | |
| 36 | 39 | * Verified against Divi 5.0.1. |
| 37 | 40 | */ |
| 38 | -class DiviSettingsReader implements ThemeSettingsReader | |
| 41 | +class DiviSettingsReader implements ThemeSettingsReader, ThemeRadiusReader | |
| 39 | 42 | { |
| 40 | 43 | /** |
| 41 | 44 | * Divi's defaults (GlobalData::$customizer_colors, the Customizer settings |
| 42 | 45 | * and the static stylesheet). |
| @@ -190,6 +193,26 @@ | ||
| 190 | 193 | |
| 191 | 194 | $raw = trim($raw); |
| 192 | 195 | |
| 193 | 196 | return preg_match('/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/', $raw) ? strtolower(ColorMath::hex($raw)) : ''; |
| 197 | + } | |
| 198 | + | |
| 199 | + /** | |
| 200 | + * The button radius. | |
| 201 | + * | |
| 202 | + * `all_buttons_border_radius` is a whole number of px (sanitised with | |
| 203 | + * `absint`, range 0–100), read exactly as Divi's customizer CSS reads it: | |
| 204 | + * `absint( et_get_option( 'all_buttons_border_radius', '3' ) )` | |
| 205 | + * (functions.php). Divi prints it when it is not 3; at 3 its stylesheet | |
| 206 | + * paints the same 3px. | |
| 207 | + * | |
| 208 | + * @return array Role => length. | |
| 209 | + */ | |
| 210 | + public static function radii(): array | |
| 211 | + { | |
| 212 | + if (!self::applies()) { | |
| 213 | + return []; | |
| 214 | + } | |
| 215 | + | |
| 216 | + return ['btn' => absint(et_get_option('all_buttons_border_radius', '3')) . 'px']; | |
| 194 | 217 | } |
| 195 | 218 | } |