← All changes
|
modules/atomic-widgets/css-converter/property-converter-base.php
+14
-0
4.2.2
→
4.3.1
View file →
| @@ -24,13 +24,27 @@ | ||
| 24 | 24 | return in_array( $property, $this->get_supported_properties(), true ); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function convert( Conversion_Context $context, array $rule ): bool { |
| 28 | + $custom = $this->get_custom_converter( $context, $rule ); | |
| 29 | + | |
| 30 | + if ( null !== $custom ) { | |
| 31 | + return $custom(); | |
| 32 | + } | |
| 33 | + | |
| 28 | 34 | if ( null === $rule['value'] ) { |
| 29 | 35 | return $this->convert_null( $context, $rule ); |
| 30 | 36 | } |
| 31 | 37 | |
| 32 | 38 | return $this->do_convert( $context, $rule ); |
| 39 | + } | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * Override to handle special-case rules before the standard null-check and do_convert path. | |
| 43 | + * Receives the full rule (value may be null). Return null to fall through to default behavior. | |
| 44 | + */ | |
| 45 | + protected function get_custom_converter( Conversion_Context $context, array $rule ): ?callable { | |
| 46 | + return null; | |
| 33 | 47 | } |
| 34 | 48 | |
| 35 | 49 | /** |
| 36 | 50 | * Override to customize null-reset behavior. Default: set the prop to null directly. |