PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.2
Elementor Website Builder – more than just a page builder v4.3.2
4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 All 455 releases
← All changes | modules/atomic-widgets/css-converter/property-converter-base.php +32 -1 4.2.0-beta1 → 4.3.2 View file →
@@ -23,6 +23,37 @@
23 23
24 24 return in_array( $property, $this->get_supported_properties(), true );
25 25 }
26 26
27 - abstract public function convert( Conversion_Context $context, array $rule ): bool;
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 +
34 + if ( null === $rule['value'] ) {
35 + return $this->convert_null( $context, $rule );
36 + }
37 +
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;
47 + }
48 +
49 + /**
50 + * Override to customize null-reset behavior. Default: set the prop to null directly.
51 + */
52 + protected function convert_null( Conversion_Context $context, array $rule ): bool {
53 + $context->set_prop( $rule['property'], null );
54 +
55 + return true;
56 + }
57 +
58 + abstract protected function do_convert( Conversion_Context $context, array $rule ): bool;
28 59 }