elementor
/
modules
/
mcp
/
abilities
/
appliers
/
v3
/
serializer
/
serializers
/
base-property-serializer.php
base-property-serializer.php in Elementor Website Builder – more than just a page builder 4.3.2, at modules/mcp/abilities/appliers/v3/serializer/serializers/base-property-serializer.php
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor\Modules\Mcp\Abilities\Appliers\V3\Serializer\Serializers; |
| 4 | |
| 5 | use Elementor\Modules\Mcp\Abilities\Appliers\V3\Mapper\Responsive_Key_Resolver; |
| 6 | use Elementor\Modules\Mcp\Abilities\Appliers\V3\Serializer\V3_Block_Accumulator; |
| 7 | use Elementor\Modules\Mcp\Abilities\Appliers\V3\Serializer\V3_Property_Serializer; |
| 8 | use Elementor\Modules\Mcp\Abilities\Appliers\V3\V3_Value_Formatters; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Common helpers for concrete serializers: responsive-suffix walking and |
| 16 | * setting-key -> CSS emission via {@see V3_Value_Formatters}. |
| 17 | */ |
| 18 | abstract class Base_Property_Serializer implements V3_Property_Serializer { |
| 19 | |
| 20 | const RESPONSIVE_SUFFIXES = [ |
| 21 | '_tablet' => 'tablet', |
| 22 | '_mobile' => 'mobile', |
| 23 | ]; |
| 24 | |
| 25 | const BASE_BREAKPOINT = Responsive_Key_Resolver::BASE_BREAKPOINT; |
| 26 | |
| 27 | protected function emit_setting_at_breakpoint( |
| 28 | V3_Block_Accumulator $blocks, |
| 29 | array $settings, |
| 30 | string $property, |
| 31 | ?string $state, |
| 32 | string $setting_key, |
| 33 | string $resolver, |
| 34 | string $breakpoint |
| 35 | ): void { |
| 36 | if ( ! array_key_exists( $setting_key, $settings ) ) { |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | $css_value = V3_Value_Formatters::format( $resolver, $settings[ $setting_key ] ); |
| 41 | if ( null === $css_value ) { |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | $blocks->push( $breakpoint, $state, $property, $css_value ); |
| 46 | } |
| 47 | } |
| 48 |