elementor
/
modules
/
mcp
/
abilities
/
appliers
/
v3
/
serializer
/
serializers
/
simple-setting-serializer.php
simple-setting-serializer.php in Elementor Website Builder – more than just a page builder 4.3.2, at modules/mcp/abilities/appliers/v3/serializer/serializers/simple-setting-serializer.php
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor\Modules\Mcp\Abilities\Appliers\V3\Serializer\Serializers; |
| 4 | |
| 5 | use Elementor\Modules\Mcp\Abilities\Appliers\V3\Serializer\V3_Block_Accumulator; |
| 6 | |
| 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | exit; |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * Inverse of {@see \Elementor\Modules\Mcp\Abilities\Appliers\V3\Converter\Converters\Simple_Setting_Converter}. |
| 13 | * Emits declarations for `setting` + `resolver` overrides (and their `_tablet`/`_mobile` |
| 14 | * responsive variants when applicable). |
| 15 | */ |
| 16 | class Simple_Setting_Serializer extends Base_Property_Serializer { |
| 17 | |
| 18 | public function is_supported( array $entry, string $property, ?string $state ): bool { |
| 19 | if ( isset( $entry['typography_prefix'] ) || isset( $entry['border_prefix'] ) || isset( $entry['box_shadow_prefix'] ) ) { |
| 20 | return false; |
| 21 | } |
| 22 | |
| 23 | return isset( $entry['setting'], $entry['resolver'] ); |
| 24 | } |
| 25 | |
| 26 | public function emit( V3_Block_Accumulator $blocks, array $settings, array $entry, string $property, ?string $state ): void { |
| 27 | $setting_key = (string) $entry['setting']; |
| 28 | $resolver = (string) $entry['resolver']; |
| 29 | $responsive = ! empty( $entry['responsive'] ); |
| 30 | |
| 31 | $this->emit_setting_at_breakpoint( $blocks, $settings, $property, $state, $setting_key, $resolver, self::BASE_BREAKPOINT ); |
| 32 | |
| 33 | if ( ! $responsive ) { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | foreach ( self::RESPONSIVE_SUFFIXES as $suffix => $breakpoint ) { |
| 38 | $this->emit_setting_at_breakpoint( $blocks, $settings, $property, $state, $setting_key . $suffix, $resolver, $breakpoint ); |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 |