PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0
Elementor Website Builder – more than just a page builder v4.3.0
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 4.0.8 All 454 releases
elementor / modules / atomic-widgets / css-converter / expanders / physical-to-logical-expander.php

physical-to-logical-expander.php in Elementor Website Builder – more than just a page builder 4.3.0, at modules/atomic-widgets/css-converter/expanders/physical-to-logical-expander.php

46 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\AtomicWidgets\CssConverter\Expanders;
4
5 use Elementor\Modules\AtomicWidgets\CssConverter\Shorthand_Expander_Base;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 /**
12 * Rewrites physical inset properties (top, right, bottom, left) to their logical equivalents
13 * (inset-block-start, inset-inline-end, inset-block-end, inset-inline-start) so the standard
14 * Size converters can handle them without needing separate converter registrations.
15 *
16 * Assumes LTR writing mode, which matches the Elementor canvas default.
17 */
18 class Physical_To_Logical_Expander extends Shorthand_Expander_Base {
19 const PHYSICAL_TO_LOGICAL = [
20 'top' => 'inset-block-start',
21 'right' => 'inset-inline-end',
22 'bottom' => 'inset-block-end',
23 'left' => 'inset-inline-start',
24 ];
25
26 protected function get_supported_properties(): array {
27 return array_keys( self::PHYSICAL_TO_LOGICAL );
28 }
29
30 protected function expand_null( array $rule ): array {
31 return [ $this->null_rule( self::PHYSICAL_TO_LOGICAL[ $rule['property'] ] ) ];
32 }
33
34 protected function do_expand( array $rule ): array {
35 $logical = self::PHYSICAL_TO_LOGICAL[ $rule['property'] ];
36
37 return [
38 [
39 'property' => $logical,
40 'value' => $rule['value'],
41 'declaration' => $logical . ': ' . $rule['value'],
42 ],
43 ];
44 }
45 }
46