How do I get Responsive Control values in Elementor, where 'selectors' => [] method can't be used?

I'm developing a custom elementor widget, and I'm trying to set font-variation-settings which includes weight and optical size. Please note that, I can NOT set weight using font-weight property and then set optical-size individually as a single attribute under font-variation-settings using 'selectors' => [] method, so that's not a solution. The font-variation-settings may later have more attributes, and all ofc need to written as a single css property. Now, the problem I'm getting is that I couldn't set responsive font-variation-settings, the desktop values are getting applied for tablet and mobile as well. It's just not working. So, how I get values for such controls where 'selectors' => [] method can't be used? Here's my code: 1. Weight Control (WGHT) $this->add_responsive_control( 'weight', [ 'type' => \Elementor\Controls_Manager::SLIDER, 'label' => esc_html__('Weight', 'textdomain'), 'size_units' => ['px', '%', 'em', 'rem'], 'range' => [ 'px' => [ 'min' => 100, 'max' => 700, 'step' => 100, ], ], 'devices' => ['desktop', 'tablet', 'mobile'], 'default' => [ 'size' => 400, 'unit' => 'px', ], ] ); 2. Optical Size Control (OPSZ) $this->add_responsive_control( 'optical_size', [ 'type' => \Elementor\Controls_Manager::SLIDER, 'label' => esc_html__('Optical Size', 'textdomain'), 'size_units' => ['px', '%', 'em', 'rem'], 'range' => [ 'px' => [ 'min' => 10, 'max' => 100, 'step' => 10, ], ], 'devices' => ['desktop', 'tablet', 'mobile'], 'default' => [ 'size' => 16, 'unit' => 'px', ], ] ); 3. Rendering the text protected function render() { $settings = $this->get_settings_for_display(); $weight = $settings['weight']['size']; $optical_size = $settings['optical_size']['size']; echo '<span style="font-variation-settings: \'wght\' ' . esc_attr($weight) . ', \'opsz\' ' . esc_attr($optical_size) . ';">Sample Text</span>'; } Well, I looked at Elementor Docs, and there is this - Elementor Docs > Responsive Data So, there is no information, and it's WIP since 2023.

Comment (0)

You’ll be in good company